Debian Codegraph @

src/requester/mod.rs

raw symbols SCIP
1 #[cfg(feature = "hyper-requester")]
2 mod hyper;
3 #[cfg(feature = "hyper-requester")]
4 pub use hyper::*;
5
6 #[cfg(feature = "reqwest-requester")]
7 mod reqwestrust-analyzer cargo railway-core 0.3.0 requester/reqwest/;
8 #[cfg(feature = "reqwest-requester")]
9 pub use reqwestrust-analyzer cargo railway-core 0.3.0 requester/reqwest/::*;
10
11 use async_traitrust-analyzer cargo async-trait 0.1.85 crate/::async_traitrust-analyzer cargo async-trait 0.1.85 async_trait:;
12 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#;
13
14 /// A general trait to query data from the internet.
15 ///
16 /// This makes requests to a specified API with a specified body and headers, returning the bytes received.
17 /// It only supports limited HTTP(s) capabilities for now, further capabilities may be added if required.
18 #[cfg_attr(feature = "rt-multi-thread", async_trait)]
19 #[cfg_attr(not(feature = "rt-multi-thread"), async_trait(?Send))]
20 pub trait Requesterrust-analyzer cargo railway-core 0.3.0 requester/Requester#: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# {
21 /// Errors this requester may produce.
22 type Errorrust-analyzer cargo railway-core 0.3.0 requester/Requester#Error#: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
23
24 /// Make a GET request.
25 async fn getrust-analyzer cargo railway-core 0.3.0 requester/Requester#get().(
26 &self,
27 url: &urlrust-analyzer cargo url 2.5.7 crate/::Urlrust-analyzer cargo url 2.5.7 Url#,
28 body: &[u8],
29 headers: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, &str>,
30 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, Self::Errorrust-analyzer cargo railway-core 0.3.0 requester/Requester#Error#>;
31
32 /// Make a POST request.
33 async fn postrust-analyzer cargo railway-core 0.3.0 requester/Requester#post().(
34 &self,
35 url: &urlrust-analyzer cargo url 2.5.7 crate/::Urlrust-analyzer cargo url 2.5.7 Url#,
36 body: &[u8],
37 headers: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, &str>,
38 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, Self::Errorrust-analyzer cargo railway-core 0.3.0 requester/Requester#Error#>;
39 }
40
41 /// Build a [`Requester`].
42 ///
43 /// This allows a provider to specify e.g. custom certificates.
44 pub trait RequesterBuilderrust-analyzer cargo railway-core 0.3.0 requester/RequesterBuilder# {
45 /// The [`Requester`] built by this builder.
46 type Requesterrust-analyzer cargo railway-core 0.3.0 requester/RequesterBuilder#Requester#: Requesterrust-analyzer cargo railway-core 0.3.0 requester/Requester#;
47
48 /// Add a custom certificate, formatted as a PEM-bundle which should be accepted.
49 fn with_pem_bundlerust-analyzer cargo railway-core 0.3.0 requester/RequesterBuilder#with_pem_bundle().(self, bytes: &[u8]) -> Self;
50
51 /// Build the [`Requester`].
52 fn buildrust-analyzer cargo railway-core 0.3.0 requester/RequesterBuilder#build().(self) -> Self::Requesterrust-analyzer cargo railway-core 0.3.0 requester/RequesterBuilder#Requester#;
53 }