pub(crate) struct Client {
sender: Sender<Command>,
}Fields§
§sender: Sender<Command>Implementations§
Source§impl Client
impl Client
Sourcepub(crate) async fn start_listening(
&mut self,
addr: Multiaddr,
) -> Result<(), Box<dyn Error + Send>>
pub(crate) async fn start_listening( &mut self, addr: Multiaddr, ) -> Result<(), Box<dyn Error + Send>>
Listen for incoming connections on the given address.
Sourcepub(crate) async fn dial(
&mut self,
peer_id: PeerId,
peer_addr: Multiaddr,
) -> Result<(), Box<dyn Error + Send>>
pub(crate) async fn dial( &mut self, peer_id: PeerId, peer_addr: Multiaddr, ) -> Result<(), Box<dyn Error + Send>>
Dial the given peer at the given address.
Sourcepub(crate) async fn start_providing(&mut self, file_name: String)
pub(crate) async fn start_providing(&mut self, file_name: String)
Advertise the local node as the provider of the given file on the DHT.
Sourcepub(crate) async fn get_providers(
&mut self,
file_name: String,
) -> HashSet<PeerId>
pub(crate) async fn get_providers( &mut self, file_name: String, ) -> HashSet<PeerId>
Find the providers for the given file on the DHT.
Sourcepub(crate) async fn request_file(
&mut self,
peer: PeerId,
file_name: String,
) -> Result<Vec<u8>, Box<dyn Error + Send>>
pub(crate) async fn request_file( &mut self, peer: PeerId, file_name: String, ) -> Result<Vec<u8>, Box<dyn Error + Send>>
Request the content of the given file from the given peer.
Sourcepub(crate) async fn respond_file(
&mut self,
file: Vec<u8>,
channel: ResponseChannel<FileResponse>,
)
pub(crate) async fn respond_file( &mut self, file: Vec<u8>, channel: ResponseChannel<FileResponse>, )
Respond with the provided file content to the given request.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more