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>
impl<T> WithPrefix<T>
sourcepub const fn new(prefix: String, inner: T) -> Self
pub const fn new(prefix: String, inner: T) -> Self
Builds a new WithPrefix
.
Trait Implementations§
source§impl<T: Clone> Clone for WithPrefix<T>
impl<T: Clone> Clone for WithPrefix<T>
source§fn clone(&self) -> WithPrefix<T>
fn clone(&self) -> WithPrefix<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for WithPrefix<T>
impl<T: Debug> Debug for WithPrefix<T>
source§impl<T: PlatformRef> PlatformRef for WithPrefix<T>
impl<T: PlatformRef> PlatformRef for WithPrefix<T>
source§type Delay = <T as PlatformRef>::Delay
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
type Instant = <T as PlatformRef>::Instant
A certain point in time. Typically
std::time::Instant
, but one can also
use core::time::Duration
. Read moresource§type MultiStream = <T as PlatformRef>::MultiStream
type MultiStream = <T as PlatformRef>::MultiStream
A multi-stream connection. Read more
source§type Stream = <T as PlatformRef>::Stream
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>
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>
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
type StreamConnectFuture = <T as PlatformRef>::StreamConnectFuture
Future
returned by PlatformRef::connect_stream
.source§type MultiStreamConnectFuture = <T as PlatformRef>::MultiStreamConnectFuture
type MultiStreamConnectFuture = <T as PlatformRef>::MultiStreamConnectFuture
Future
returned by PlatformRef::connect_multistream
.source§type StreamUpdateFuture<'a> = <T as PlatformRef>::StreamUpdateFuture<'a>
type StreamUpdateFuture<'a> = <T as PlatformRef>::StreamUpdateFuture<'a>
Future
returned by PlatformRef::wait_read_write_again
.source§type NextSubstreamFuture<'a> = <T as PlatformRef>::NextSubstreamFuture<'a>
type NextSubstreamFuture<'a> = <T as PlatformRef>::NextSubstreamFuture<'a>
Future
returned by PlatformRef::next_substream
.source§fn now_from_unix_epoch(&self) -> Duration
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 fill_random_bytes(&self, buffer: &mut [u8])
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
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
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,
)
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)>,
)
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>
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>
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
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 moresource§fn connect_stream(&self, address: Address<'_>) -> Self::StreamConnectFuture
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
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)
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>
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>>
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 moresource§fn wait_read_write_again<'a>(
&self,
stream: Pin<&'a mut Self::Stream>,
) -> Self::StreamUpdateFuture<'a>
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 moreAuto 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> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn 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>
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)
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)
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
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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