Skip to main content

Hopr

Struct Hopr 

Source
pub struct Hopr<Chain, Graph, Net, TMgr> {
    pub(crate) transport_id: OffchainKeypair,
    pub(crate) chain_id: NodeOnchainIdentity,
    pub(crate) cfg: HoprLibConfig,
    pub(crate) state: Arc<AtomicHoprState>,
    pub(crate) transport_api: HoprTransport<Chain, Graph, Net>,
    pub(crate) chain_api: Chain,
    pub(crate) ticket_event_subscribers: (Sender<TicketEvent>, InactiveReceiver<TicketEvent>),
    pub(crate) ticket_manager: TMgr,
    pub(crate) processes: AbortableList<HoprLibProcess>,
}
Expand description

HOPR main object providing the entire HOPR node functionality

Instantiating this object creates all processes and objects necessary for running the HOPR node. Once created, the node can be started using the run() method.

Externally offered API should be enough to perform all necessary tasks with the HOPR node manually, but it is advised to create such a configuration that manual interaction is unnecessary.

As such, the hopr_lib serves mainly as an integration point into Rust programs.

Fields§

§transport_id: OffchainKeypair§chain_id: NodeOnchainIdentity§cfg: HoprLibConfig§state: Arc<AtomicHoprState>§transport_api: HoprTransport<Chain, Graph, Net>§chain_api: Chain§ticket_event_subscribers: (Sender<TicketEvent>, InactiveReceiver<TicketEvent>)§ticket_manager: TMgr§processes: AbortableList<HoprLibProcess>

Implementations§

Source§

impl<Chain, Graph, Net, TMgr> Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + Clone + Send + Sync + 'static, Graph: HoprGraphApi<HoprNodeId = OffchainPublicKey> + Clone + Send + Sync + 'static, <Graph as NetworkGraphTraverse>::Observed: EdgeObservableRead + Send + 'static, <Graph as NetworkGraphWrite>::Observed: EdgeObservableWrite + Send, Net: NetworkView + NetworkStreamControl + Send + Sync + Clone + 'static,

Source

pub fn config(&self) -> &HoprLibConfig

Source

pub fn graph(&self) -> &Graph

Returns a reference to the network graph.

Source

pub(crate) fn error_if_not_in_state( &self, state: HoprState, error: String, ) -> Result<()>

Source

pub(crate) async fn connect_to_with_transport_config( &self, destination: Address, target: SessionTarget, cfg: SessionClientConfig, ) -> Result<(HoprSession, HoprSessionConfigurator), HoprLibError>

Source§

impl<Chain, Graph, Net, TMgr> Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + ComponentStatusReporter + Clone + Send + Sync + 'static, Net: NetworkView + NetworkStreamControl + Send + Sync + Clone + 'static, Graph: HoprGraphApi<HoprNodeId = OffchainPublicKey> + NetworkGraphConnectivity<NodeId = OffchainPublicKey> + Clone + Send + Sync + 'static, <Graph as NetworkGraphTraverse>::Observed: EdgeObservableRead + Send + 'static, <Graph as NetworkGraphWrite>::Observed: EdgeObservableWrite + Send, TMgr: Send + Sync + 'static,

Source

pub fn component_statuses(&self) -> NodeComponentStatuses

Returns per-component health statuses for the node.

When the node has reached Running, the aggregate node_state is derived from component statuses (Running → Degraded → Failed).

Trait Implementations§

Source§

impl<Chain, Graph, Net, TMgr> ActionableEventSource for Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + Send + Sync + 'static, Graph: Send + Sync + 'static, Net: NetworkView + Send + Sync + 'static, TMgr: Send + Sync + 'static,

Source§

fn subscribe_to_actionable_events( &self, filter: Option<&[ActionableEventDiscriminant]>, ) -> Result<BoxStream<'static, ActionableEvent>, String>

Subscribe to a merged stream of actionable events. Read more
Source§

impl<Chain, Graph, Net, TMgr> Debug for Hopr<Chain, Graph, Net, TMgr>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Chain, Graph, Net, TMgr> HasChainApi for Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + ComponentStatusReporter + Clone + Send + Sync + 'static,

Source§

type ChainApi = Chain

The concrete chain API implementation.
Source§

type ChainError = HoprLibError

Error type for node-level chain operations (distinct from on-chain errors).
Source§

fn identity(&self) -> &NodeOnchainIdentity

Returns the node’s on-chain identity (node address, Safe address, module address).
Source§

fn chain_api(&self) -> &Chain

Returns a reference to the underlying chain API.
Source§

fn status(&self) -> ComponentStatus

Reports the current health of the chain component.
Source§

fn wait_for_on_chain_event<F>( &self, predicate: F, context: String, timeout: Duration, ) -> EventWaitResult<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>
where F: Fn(&ChainEvent) -> bool + Send + Sync + 'static,

Spawns an asynchronous waiter that subscribes to [ChainEvent]s and resolves when predicate matches or timeout elapses.
Source§

impl<Chain, Graph, Net, TMgr> HasGraphView for Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + Clone + Send + Sync + 'static, Graph: HoprGraphApi<HoprNodeId = OffchainPublicKey> + NetworkGraphConnectivity<NodeId = OffchainPublicKey> + Clone + Send + Sync + 'static, <Graph as NetworkGraphTraverse>::Observed: EdgeObservableRead + Send + 'static, <Graph as NetworkGraphWrite>::Observed: EdgeObservableWrite + Send, Net: NetworkView + NetworkStreamControl + Send + Sync + Clone + 'static,

Source§

type Graph = Graph

The concrete graph type, constrained to read-only operations.
Source§

fn graph(&self) -> &Graph

Returns a reference to the network graph.
Source§

fn status(&self) -> ComponentStatus

Reports the current health of the graph component.
Source§

impl<Chain, Graph, Net, TMgr> HasNetworkView for Hopr<Chain, Graph, Net, TMgr>
where Chain: Send + Sync + 'static, Graph: Send + Sync + 'static, Net: NetworkView + Send + Sync + 'static,

Source§

type NetworkView = HoprTransport<Chain, Graph, Net>

The concrete [NetworkView] implementation.
Source§

fn network_view(&self) -> &Self::NetworkView

Returns a reference to the network view.
Source§

fn status(&self) -> ComponentStatus

Reports the current health of the network component.
Source§

impl<Chain, Graph, Net, TMgr> HasTicketManagement for Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + Clone + Send + Sync + 'static, TMgr: TicketManagement + Clone + Send + Sync + 'static,

Source§

type TicketManager = TMgr

The concrete [TicketManagement] implementation.
Source§

fn ticket_management(&self) -> &TMgr

Returns a reference to the ticket manager.
Source§

fn subscribe_ticket_events( &self, ) -> impl Stream<Item = TicketEvent> + Send + 'static

Returns a stream of [TicketEvent]s from the transport layer.
Source§

fn status(&self) -> ComponentStatus

Reports the current health of the ticket management component.
Source§

impl<Chain, Graph, Net, TMgr> HasTransportApi for Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + Clone + Send + Sync + 'static, Graph: HoprGraphApi<HoprNodeId = OffchainPublicKey> + Clone + Send + Sync + 'static, <Graph as NetworkGraphTraverse>::Observed: EdgeObservableRead + Send + 'static, <Graph as NetworkGraphWrite>::Observed: EdgeObservableWrite + Send, Net: NetworkView + NetworkStreamControl + Send + Sync + Clone + 'static, TMgr: Send + Sync + 'static,

Source§

type Transport = HoprTransport<Chain, Graph, Net>

The concrete [TransportOperations] implementation.
Source§

fn transport(&self) -> &Self::Transport

Returns a reference to the transport API.
Source§

fn status(&self) -> ComponentStatus

Reports the current health of the transport component.
Source§

impl<Chain, Graph, Net, TMgr> HoprNodeOperations for Hopr<Chain, Graph, Net, TMgr>

Source§

fn status(&self) -> HoprState

Returns the runtime status of the node.
Source§

impl<Chain, Graph, Net, TMgr> HoprSessionClientOperations for Hopr<Chain, Graph, Net, TMgr>
where Chain: HoprChainApi + Clone + Send + Sync + 'static, Graph: HoprGraphApi<HoprNodeId = OffchainPublicKey> + Clone + Send + Sync + 'static, <Graph as NetworkGraphTraverse>::Observed: EdgeObservableRead + Send + 'static, <Graph as NetworkGraphWrite>::Observed: EdgeObservableWrite + Send, Net: NetworkView + NetworkStreamControl + Send + Sync + Clone + 'static, TMgr: Send + Sync + 'static,

Source§

type Config = HoprSessionClientConfig

Configuration for the session (routing, capabilities, etc.).
Source§

type Error = HoprLibError

Error type for session operations.
Source§

type Session = HoprSession

An established session implementing async read/write.
Source§

type SessionConfigurator = HoprSessionConfigurator

Handle for controlling a session after creation (e.g. keep-alive, SURB config).
Source§

type Target = SessionTarget

Describes the remote service to connect to.
Source§

fn connect_to<'life0, 'async_trait>( &'life0 self, destination: Address, target: Self::Target, cfg: Self::Config, ) -> Pin<Box<dyn Future<Output = Result<(Self::Session, Self::SessionConfigurator), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Establishes a new session to the given destination via the HOPR network. Read more

Auto Trait Implementations§

§

impl<Chain, Graph, Net, TMgr> Freeze for Hopr<Chain, Graph, Net, TMgr>
where Chain: Freeze, TMgr: Freeze, Graph: Freeze,

§

impl<Chain, Graph, Net, TMgr> !RefUnwindSafe for Hopr<Chain, Graph, Net, TMgr>

§

impl<Chain, Graph, Net, TMgr> Send for Hopr<Chain, Graph, Net, TMgr>
where Chain: Send + Sync, TMgr: Send, Graph: Send + Sync, Net: Sync + Send,

§

impl<Chain, Graph, Net, TMgr> Sync for Hopr<Chain, Graph, Net, TMgr>
where Chain: Sync + Send, TMgr: Sync, Graph: Sync + Send, Net: Sync + Send,

§

impl<Chain, Graph, Net, TMgr> Unpin for Hopr<Chain, Graph, Net, TMgr>
where Chain: Unpin, TMgr: Unpin, Graph: Unpin,

§

impl<Chain, Graph, Net, TMgr> !UnwindSafe for Hopr<Chain, Graph, Net, TMgr>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> IncentiveChannelOperations for T
where T: HasChainApi + Send + Sync,

§

const CHAIN_OPERATION_TIMEOUT_MULTIPLIER: u32 = 2

Timeout multiplier applied to [ChainValues::typical_resolution_time] when waiting for on-chain operations to be confirmed via the event bus.
§

fn open_channel<'life0, 'async_trait, A>( &'life0 self, destination: A, amount: Balance<WxHOPR>, ) -> Pin<Box<dyn Future<Output = Result<ChainOutput<HashBase<CoreWrapper<Keccak256Core>>>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
where 'life0: 'async_trait, A: 'async_trait + Into<Address> + Send, Self: Sync + 'async_trait,

Opens a channel from the node to the given destination with the given amount as the initial stake.
§

fn fund_channel<'life0, 'life1, 'async_trait>( &'life0 self, channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>, amount: Balance<WxHOPR>, ) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Funds an existing channel with the given amount.
§

fn close_channel_by_id<'life0, 'life1, 'async_trait>( &'life0 self, channel_id: &'life1 HashBase<CoreWrapper<Keccak256Core>>, ) -> Pin<Box<dyn Future<Output = Result<ChainOutput<ChannelStatus>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Initiates or finalizes the closure of a channel.
§

fn channel_by_id( &self, channel_id: &HashBase<CoreWrapper<Keccak256Core>>, ) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>

Returns a channel with the given channel_id.
§

fn channel<A, B>( &self, source: A, destination: B, ) -> Result<Option<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>
where A: Into<Address> + Send, B: Into<Address> + Send,

Returns a channel between source and destination.
§

fn channels_to<'life0, 'async_trait, A>( &'life0 self, destination: A, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, A: 'async_trait + Into<Address> + Send, Self: Sync + 'async_trait,

Returns all channels to the given destination.
§

fn channels_from<'life0, 'async_trait, A>( &'life0 self, source: A, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChannelEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, A: 'async_trait + Into<Address> + Send, Self: Sync + 'async_trait,

Returns all channels from the given source.
§

fn get_balance<'life0, 'async_trait, C>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, C: 'async_trait + Currency + Send, Self: Sync + 'async_trait,

Returns the balance of [Currency] in the node’s account.
§

fn get_safe_balance<'life0, 'async_trait, C>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance<C>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, C: 'async_trait + Currency + Send, Self: Sync + 'async_trait,

Returns the balance of [Currency] in the node’s Safe.
§

fn safe_allowance<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns the allowance of the node’s Safe to spend funds in channels.
§

fn withdraw<'life0, 'life1, 'async_trait, C>( &'life0 self, recipient: &'life1 Address, amount: Balance<C>, ) -> Pin<Box<dyn Future<Output = Result<ChainOutput<()>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, C: 'async_trait + Currency + Send, Self: Sync + 'async_trait,

Withdraws the given amount of [Currency] from the node to the recipient.
§

fn chain_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ChainInfo, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns information about the connected blockchain.
§

fn get_ticket_price<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Balance<WxHOPR>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns the minimum ticket price from the blockchain.
§

fn get_minimum_incoming_ticket_win_probability<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<WinningProbability, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns the minimum win probability of an incoming ticket.
§

fn get_channel_closure_notice_period<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Duration, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns the channel closure grace period.
§

fn announced_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<AccountEntry>, <Self::ChainApi as HoprChainApi>::ChainError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns all peers that have been publicly announced on-chain.
§

impl<T> IncentiveRedeemOperations for T
where T: HasChainApi + HasTicketManagement + Send + Sync,

§

const PENDING_TO_CLOSE_REDEMPTION_TOLERANCE: Duration = _

How long before the channel closure grace period elapses should we still try to redeem tickets.
§

fn redeem_all_tickets<'life0, 'async_trait, B>( &'life0 self, min_value: B, ) -> Pin<Box<dyn Future<Output = Result<Vec<RedemptionResult>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, <Self::TicketManager as TicketManagement>::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait, B: 'async_trait + Into<Balance<WxHOPR>> + Send, Self: Sync + 'async_trait,

Redeems all redeemable tickets in all incoming channels. Read more
§

fn redeem_tickets_with_counterparty<'life0, 'async_trait, A, B>( &'life0 self, issuer: A, min_value: B, ) -> Pin<Box<dyn Future<Output = Result<Vec<RedemptionResult>, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, <Self::TicketManager as TicketManagement>::Error>>> + Send + 'async_trait>>
where 'life0: 'async_trait, A: 'async_trait + Into<Address> + Send, B: 'async_trait + Into<Balance<WxHOPR>> + Send, Self: Sync + 'async_trait,

Redeems all incoming tickets from the given issuer. Read more
§

fn ticket_statistics( &self, ) -> Result<ChannelStats, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, <Self::TicketManager as TicketManagement>::Error>>

Returns [ChannelStats] for all incoming channels which have tickets.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more