Struct smoldot_light::platform::WithPrefix

source ·
pub struct WithPrefix<T> { /* private fields */ }
Expand description

Implementation of a PlatformRef that wraps around another platform and adds a prefix before every log line and task name.

Implementations§

source§

impl<T> WithPrefix<T>

source

pub const fn new(prefix: String, inner: T) -> Self

Builds a new WithPrefix.

Trait Implementations§

source§

impl<T: Clone> Clone for WithPrefix<T>

source§

fn clone(&self) -> WithPrefix<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for WithPrefix<T>

source§

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

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

impl<T: PlatformRef> PlatformRef for WithPrefix<T>

source§

type Delay = <T as PlatformRef>::Delay

Future that resolves once a certain amount of time has passed or a certain point in time is reached. See PlatformRef::sleep and PlatformRef::sleep_until.
source§

type Instant = <T as PlatformRef>::Instant

A certain point in time. Typically std::time::Instant, but one can also use core::time::Duration. Read more
source§

type MultiStream = <T as PlatformRef>::MultiStream

A multi-stream connection. Read more
source§

type Stream = <T as PlatformRef>::Stream

Opaque object representing either a single-stream connection or a substream in a multi-stream connection. Read more
source§

type ReadWriteAccess<'a> = <T as PlatformRef>::ReadWriteAccess<'a>

Object that dereferences to read_write::ReadWrite and gives access to the stream’s buffers. See the read_write module for more information. See also PlatformRef::read_write_access.
source§

type StreamErrorRef<'a> = <T as PlatformRef>::StreamErrorRef<'a>

Reference to an error that happened on a stream. Read more
source§

type StreamConnectFuture = <T as PlatformRef>::StreamConnectFuture

Future returned by PlatformRef::connect_stream.
source§

type MultiStreamConnectFuture = <T as PlatformRef>::MultiStreamConnectFuture

source§

type StreamUpdateFuture<'a> = <T as PlatformRef>::StreamUpdateFuture<'a>

source§

type NextSubstreamFuture<'a> = <T as PlatformRef>::NextSubstreamFuture<'a>

Future returned by PlatformRef::next_substream.
source§

fn now_from_unix_epoch(&self) -> Duration

Returns the time elapsed since the Unix Epoch (i.e. 00:00:00 UTC on 1 January 1970), ignoring leap seconds. Read more
source§

fn now(&self) -> Self::Instant

Returns an object that represents “now”.
source§

fn fill_random_bytes(&self, buffer: &mut [u8])

The given buffer must be completely filled with pseudo-random bytes. Read more
source§

fn sleep(&self, duration: Duration) -> Self::Delay

Creates a future that becomes ready after at least the given duration has elapsed.
source§

fn sleep_until(&self, when: Self::Instant) -> Self::Delay

Creates a future that becomes ready after the given instant has been reached.
source§

fn spawn_task( &self, task_name: Cow<'_, str>, task: impl Future<Output = ()> + Send + 'static, )

Spawns a task that runs indefinitely in the background. Read more
source§

fn log<'a>( &self, log_level: LogLevel, log_target: &'a str, message: &'a str, key_values: impl Iterator<Item = (&'a str, &'a dyn Display)>, )

Emit a log line. Read more
source§

fn client_name(&self) -> Cow<'_, str>

Value returned when a JSON-RPC client requests the name of the client, or when a peer performs an identification request. Reasonable value is env!("CARGO_PKG_NAME").
source§

fn client_version(&self) -> Cow<'_, str>

Value returned when a JSON-RPC client requests the version of the client, or when a peer performs an identification request. Reasonable value is env!("CARGO_PKG_VERSION").
source§

fn supports_connection_type(&self, connection_type: ConnectionType) -> bool

Returns true if PlatformRef::connect_stream or PlatformRef::connect_multistream accepts a connection of the corresponding type. Read more
source§

fn connect_stream(&self, address: Address<'_>) -> Self::StreamConnectFuture

Starts a connection attempt to the given address. Read more
source§

fn connect_multistream( &self, address: MultiStreamAddress<'_>, ) -> Self::MultiStreamConnectFuture

Starts a connection attempt to the given address. Read more
source§

fn open_out_substream(&self, connection: &mut Self::MultiStream)

Queues the opening of an additional outbound substream. Read more
source§

fn next_substream<'a>( &self, connection: &'a mut Self::MultiStream, ) -> Self::NextSubstreamFuture<'a>

Waits until a new incoming substream arrives on the connection. Read more
source§

fn read_write_access<'a>( &self, stream: Pin<&'a mut Self::Stream>, ) -> Result<Self::ReadWriteAccess<'a>, Self::StreamErrorRef<'a>>

Returns an object that implements DerefMut<Target = ReadWrite>. The read_write::ReadWrite object allows the API user to read data from the stream and write data to the stream. Read more
source§

fn wait_read_write_again<'a>( &self, stream: Pin<&'a mut Self::Stream>, ) -> Self::StreamUpdateFuture<'a>

Returns a future that becomes ready when PlatformRef::read_write_access should be called again on this stream. Read more

Auto Trait Implementations§

§

impl<T> Freeze for WithPrefix<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for WithPrefix<T>
where T: RefUnwindSafe,

§

impl<T> Send for WithPrefix<T>
where T: Send,

§

impl<T> Sync for WithPrefix<T>
where T: Sync,

§

impl<T> Unpin for WithPrefix<T>
where T: Unpin,

§

impl<T> UnwindSafe for WithPrefix<T>
where T: UnwindSafe,

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
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
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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