Trait ToStatic

pub trait ToStatic: Clone {
    type Static: 'static + Clone + Send + Sync;

    // Required method
    fn to_static(&self) -> Self::Static;
}
Expand description

A trait for converting types with lifetime parameters to equivalent types with ’static lifetime.

Required Associated Types§

type Static: 'static + Clone + Send + Sync

The same type but with ’static lifetime and owned data.

Required Methods§

fn to_static(&self) -> Self::Static

Converts this type to the equivalent type with ’static lifetime.

This method creates owned copies of any borrowed data, allowing the resulting type to be used in contexts that require ’static lifetime.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl ToStatic for Cow<'_, str>

§

type Static = Cow<'static, str>

§

fn to_static(&self) -> <Cow<'_, str> as ToStatic>::Static

§

impl ToStatic for Cow<'_, [KeyValue<'_>]>

§

type Static = Cow<'static, [KeyValue<'static>]>

§

fn to_static(&self) -> <Cow<'_, [KeyValue<'_>]> as ToStatic>::Static

Implementors§

§

impl ToStatic for Value<'_>

§

type Static = Value<'static>

§

impl ToStatic for TelemetryMessage<'_>

§

type Static = TelemetryMessage<'static>

§

impl ToStatic for TracingMessage<'_>

§

type Static = TracingMessage<'static>

§

impl ToStatic for InstanceMessage<'_>

§

type Static = InstanceMessage<'static>

§

impl ToStatic for LogMessage<'_>

§

type Static = LogMessage<'static>

§

impl ToStatic for SpanAddEventMessage<'_>

§

impl ToStatic for SpanCreateMessage<'_>

§

type Static = SpanCreateMessage<'static>

§

impl ToStatic for SpanSetAttributeMessage<'_>

§

impl ToStatic for KeyValue<'_>

§

type Static = KeyValue<'static>