pub struct AppHandler { /* private fields */ }Expand description
The handle passed into every route and lifecycle callback, giving application code a way to act as a consumer (express Interests, wait for the matching Data or NACK) and to shut the app down.
Cloning is cheap: every clone shares the same underlying channels and connection, so handing a clone to a spawned task or storing one in application state doesn’t create a second connection to NFD.
Implementations§
Source§impl AppHandler
impl AppHandler
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Signals the running App to stop. The current call to
App::start returns Ok(()) once background tasks notice the
cancellation and exit; in-flight route handlers are not
interrupted.
Sourcepub async fn express_interest<T>(
&mut self,
interest: impl BorrowMut<Interest<T>>,
verifier: impl DataVerifier,
) -> Result<Data<Bytes>>
pub async fn express_interest<T>( &mut self, interest: impl BorrowMut<Interest<T>>, verifier: impl DataVerifier, ) -> Result<Data<Bytes>>
Signs interest and expresses it, returning the resulting Data
once it passes verifier, or an error on NACK, verification
failure, or timeout (see crate::error::Error).
Sourcepub async fn express_interest_unsigned<T>(
&mut self,
interest: impl BorrowMut<Interest<T>>,
verifier: impl DataVerifier,
) -> Result<Data<Bytes>>
pub async fn express_interest_unsigned<T>( &mut self, interest: impl BorrowMut<Interest<T>>, verifier: impl DataVerifier, ) -> Result<Data<Bytes>>
Same as AppHandler::express_interest, but sends the Interest
unsigned. Used internally by verifiers (see
crate::verifier::RequireValidSignature) to fetch certificates
without those fetches needing a signature of their own, and
available to application code for the same reason: fetching
public data that doesn’t require proving the requester’s
identity.
Trait Implementations§
Source§impl Clone for AppHandler
impl Clone for AppHandler
Source§fn clone(&self) -> AppHandler
fn clone(&self) -> AppHandler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for AppHandler
impl !UnwindSafe for AppHandler
impl Freeze for AppHandler
impl Send for AppHandler
impl Sync for AppHandler
impl Unpin for AppHandler
impl UnsafeUnpin for AppHandler
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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