pub struct Rpc<C: Config> { /* private fields */ }Implementations§
Source§impl<C: Config> Rpc<C>
impl<C: Config> Rpc<C>
pub fn register_request_handler<R: IncomingRequest + Sync + Send + 'static + DeserializeOwned, F: Future<Output = Result<R::Response, C::Error>> + Send + 'static>( &self, cancellable: bool, handler: impl Fn(C::Address, R) -> F + Sync + Send + 'static, )
pub fn register_notification_handler<R: IncomingNotification + 'static, H: AsyncFn2<C::Address, R, Output = Result<(), C::Error>> + Sync + Send + 'static>(
&self,
handler: H,
)where
for<'a> H::OutputFuture: 'static + Send,
Sourcepub fn register_blocking_notification_handler<R: IncomingNotification + 'static, H: AsyncFn2<C::Address, R, Output = Result<(), C::Error>> + Sync + Send + 'static>(
&self,
handler: H,
)where
for<'a> H::OutputFuture: Send,
pub fn register_blocking_notification_handler<R: IncomingNotification + 'static, H: AsyncFn2<C::Address, R, Output = Result<(), C::Error>> + Sync + Send + 'static>(
&self,
handler: H,
)where
for<'a> H::OutputFuture: Send,
Only use for requests, which should be done on the current state of network, can’t be processed in parallel, and executed very fast
pub fn new(me: C::Address) -> Self
pub fn remove_direct(&self, to: C::Address)
pub fn add_direct(&self, to: C::Address, port: Port, rtt: Rtt)
pub fn notify<T: OutgoingNotification>(&self, to: C::Address, notification: &T)
pub async fn request<T: OutgoingRequest + Serialize>(
&self,
to: C::Address,
request: T,
) -> Result<T::Response, C::Error>where
T::Response: DeserializeOwned,
pub async fn wait_for_connection_to( &self, address: C::Address, ) -> Result<(), WaitError>
pub fn remote(&self, address: C::Address) -> Remote<C>
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Rpc<C>
impl<C> RefUnwindSafe for Rpc<C>
impl<C> Send for Rpc<C>
impl<C> Sync for Rpc<C>
impl<C> Unpin for Rpc<C>
impl<C> UnsafeUnpin for Rpc<C>
impl<C> UnwindSafe for Rpc<C>
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