pub struct ClamdClientBuilder<'a, T: ToSocketAddrs + Clone, B: ToOwned<Owned = T> + ?Sized> { /* private fields */ }
Expand description
Builder for ClamdClient
.
§Example
let address = "127.0.0.1:3310";
let mut clamd_client = ClamdClientBuilder::tcp_socket(address).chunk_size(4096).build();
Implementations§
Source§impl<'a, T, B> ClamdClientBuilder<'a, T, B>
impl<'a, T, B> ClamdClientBuilder<'a, T, B>
Sourcepub fn unix_socket<P: AsRef<Path> + ?Sized>(path: &'a P) -> Self
pub fn unix_socket<P: AsRef<Path> + ?Sized>(path: &'a P) -> Self
Build a ClamdClient
from the path to the unix socket of clamd
. Currently
this is a litte bit ugly, you have to define the types used for the tcp version. If someone
has an idea to make this more ergonomic by eliding the types somehow, please open an issue.
§Example
let path = "/var/run/clamav/clamd.sock";
// define placeholder types here that implement `ToSocketAddrs`
let mut clamd_client = ClamdClientBuilder::<String, str>::tcp_socket(path).chunk_size(4096).build();
Sourcepub fn tcp_socket(addr: &'a B) -> Self
pub fn tcp_socket(addr: &'a B) -> Self
Build a ClamdClient
from the socket address to the tcp socket of clamd
.
Sourcepub fn chunk_size(&'a mut self, chunk_size: usize) -> &'a mut Self
pub fn chunk_size(&'a mut self, chunk_size: usize) -> &'a mut Self
Set the chunk size for file streaming. Default is DEFAULT_CHUNK_SIZE
.
Sourcepub fn build(&'a self) -> ClamdClient<T>
pub fn build(&'a self) -> ClamdClient<T>
Create ClamdClient
with provided configuration.
Auto Trait Implementations§
impl<'a, T, B> Freeze for ClamdClientBuilder<'a, T, B>where
B: ?Sized,
impl<'a, T, B> RefUnwindSafe for ClamdClientBuilder<'a, T, B>where
B: RefUnwindSafe + ?Sized,
impl<'a, T, B> Send for ClamdClientBuilder<'a, T, B>
impl<'a, T, B> Sync for ClamdClientBuilder<'a, T, B>
impl<'a, T, B> Unpin for ClamdClientBuilder<'a, T, B>where
B: ?Sized,
impl<'a, T, B> UnwindSafe for ClamdClientBuilder<'a, T, B>where
B: RefUnwindSafe + ?Sized,
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