ToStatic

Trait ToStatic 

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

Source

type Static: 'static + Clone + Send + Sync

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

Required Methods§

Source

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§

Source§

impl ToStatic for Cow<'_, str>

Source§

type Static = Cow<'static, str>

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§