pub struct Receiver { /* private fields */ }Expand description
A receiver that can receive files
Implementations§
Source§impl Receiver
impl Receiver
pub async fn connect( this_endpoint: Endpoint, node_addr: NodeAddr, args: ReceiverArgs, ) -> Result<Self, ReceiveError>
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 receive_files(
&mut self,
initial_progress_callback: impl FnMut(&[(String, u64, u64)]),
accept_files_callback: impl FnMut(&[FilesAvailable]) -> Option<PathBuf>,
read_callback: &mut impl FnMut(u64),
should_continue: &mut impl FnMut() -> bool,
) -> Result<bool, ReceiveError>
pub async fn receive_files( &mut self, initial_progress_callback: impl FnMut(&[(String, u64, u64)]), accept_files_callback: impl FnMut(&[FilesAvailable]) -> Option<PathBuf>, read_callback: &mut impl FnMut(u64), should_continue: &mut impl FnMut() -> bool, ) -> Result<bool, ReceiveError>
Receive files
§Arguments
initial_progress_callback- Callback with the initial progress of each file to send (name, current, total)accept_files_callback- Callback to accept or reject the files (Some(path) to accept, None to reject)read_callback- Callback every time data is written to diskshould_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 Receiver
impl !RefUnwindSafe for Receiver
impl Send for Receiver
impl Sync for Receiver
impl Unpin for Receiver
impl !UnwindSafe for Receiver
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