pub struct Oracle<P: Array> { /* private fields */ }Expand description
Interface for modifying the simulated network.
At any point, peers can be added/removed and links between said peers can be modified.
Implementations§
Source§impl<P: Array> Oracle<P>
impl<P: Array> Oracle<P>
Sourcepub async fn register(
&mut self,
public_key: P,
channel: Channel,
) -> Result<(Sender<P>, Receiver<P>), Error>
pub async fn register( &mut self, public_key: P, channel: Channel, ) -> Result<(Sender<P>, Receiver<P>), Error>
Register a new peer with the network that can interact over a given channel.
By default, the peer will not be linked to any other peers. If a peer is already registered on a given channel, it will return an error.
Sourcepub async fn add_link(
&mut self,
sender: P,
receiver: P,
config: Link,
) -> Result<(), Error>
pub async fn add_link( &mut self, sender: P, receiver: P, config: Link, ) -> Result<(), Error>
Create a unidirectional link between two peers.
Link can be called multiple times for the same sender/receiver. The latest setting will be used.
Sourcepub async fn remove_link(&mut self, sender: P, receiver: P) -> Result<(), Error>
pub async fn remove_link(&mut self, sender: P, receiver: P) -> Result<(), Error>
Remove a unidirectional link between two peers.
If no link exists, this will return an error.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Oracle<P>
impl<P> !RefUnwindSafe for Oracle<P>
impl<P> Send for Oracle<P>
impl<P> Sync for Oracle<P>
impl<P> Unpin for Oracle<P>
impl<P> !UnwindSafe for Oracle<P>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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