pub struct Sender { /* private fields */ }Expand description
A client that can send files
Implementations§
Source§impl Sender
impl Sender
pub async fn connect( this_endpoint: Endpoint, args: SenderArgs, ) -> Result<Self, SendError>
Sourcepub async fn wait_for_close(&mut self)
pub async fn wait_for_close(&mut self)
Wait for the other peer to close the connection
Sourcepub async fn connection_type(&self) -> Option<ConnectionType>
pub async fn connection_type(&self) -> Option<ConnectionType>
Get the type of the connection
Sourcepub async fn send_files(
&mut self,
wait_for_other_peer_to_accept_files_callback: impl FnMut(),
files_decision_callback: impl FnMut(bool),
initial_progress_callback: impl FnMut(&[(String, u64, u64)]),
write_callback: &mut impl FnMut(u64),
should_continue: &mut impl FnMut() -> bool,
) -> Result<bool, SendError>
pub async fn send_files( &mut self, wait_for_other_peer_to_accept_files_callback: impl FnMut(), files_decision_callback: impl FnMut(bool), initial_progress_callback: impl FnMut(&[(String, u64, u64)]), write_callback: &mut impl FnMut(u64), should_continue: &mut impl FnMut() -> bool, ) -> Result<bool, SendError>
Send files
§Arguments
wait_for_other_peer_to_accept_files_callback- Callback to wait for the other peer to accept the filesfiles_decision_callback- Callback with the decision of the other peer to accept the filesinitial_progress_callback- Callback with the initial progress of each file to send (name, current, total)write_callback- Callback every time data is written to the connectionshould_continue- Callback to check if the transfer should continue
§Returns
Ok(true)if the transfer was finished successfullyOk(false)if the transfer was stopped
Auto Trait Implementations§
impl Freeze for Sender
impl !RefUnwindSafe for Sender
impl Send for Sender
impl Sync for Sender
impl Unpin for Sender
impl !UnwindSafe for Sender
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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