pub struct ClientConfigBuilder { /* private fields */ }
Expand description
Builder for ClientConfig
.
Implementations§
Source§impl ClientConfigBuilder
impl ClientConfigBuilder
Sourcepub fn timeout(&mut self, value: Option<Duration>) -> &mut Self
pub fn timeout(&mut self, value: Option<Duration>) -> &mut Self
Connection timeout for control requests.
Sourcepub fn transfer_timeout(&mut self, value: Option<Duration>) -> &mut Self
pub fn transfer_timeout(&mut self, value: Option<Duration>) -> &mut Self
Connection timeout specific to file transfers.
Sourcepub fn basic_auth(
&mut self,
value: Option<(String, Option<String>)>,
) -> &mut Self
pub fn basic_auth( &mut self, value: Option<(String, Option<String>)>, ) -> &mut Self
Basic HTTP authentication credentials.
Consists of a username, and an optional password.
Sourcepub fn build(&self) -> Result<ClientConfig, String>
pub fn build(&self) -> Result<ClientConfig, String>
Examples found in repository?
examples/upload.rs (line 20)
18fn upload_file(path: PathBuf) -> Result<RemoteFile, Error> {
19 // Build the client for uploading
20 let client_config = ClientConfigBuilder::default().build().unwrap();
21 let client = client_config.client(true);
22
23 #[cfg(feature = "send3")]
24 let version = Version::V3;
25 #[cfg(not(feature = "send3"))]
26 let version = Version::V2;
27
28 // Build upload action, and invoke to upload
29 let upload = Upload::new(
30 version,
31 Url::parse("https://send.firefox.com/").unwrap(),
32 path,
33 None,
34 None,
35 None,
36 );
37 Upload::invoke(upload, &client, None)
38}
Trait Implementations§
Source§impl Clone for ClientConfigBuilder
impl Clone for ClientConfigBuilder
Source§fn clone(&self) -> ClientConfigBuilder
fn clone(&self) -> ClientConfigBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for ClientConfigBuilder
impl Default for ClientConfigBuilder
Source§fn default() -> ClientConfigBuilder
fn default() -> ClientConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ClientConfigBuilder
impl RefUnwindSafe for ClientConfigBuilder
impl Send for ClientConfigBuilder
impl Sync for ClientConfigBuilder
impl Unpin for ClientConfigBuilder
impl UnwindSafe for ClientConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more