TypedClassBuilder

Struct TypedClassBuilder 

Source
pub struct TypedClassBuilder {
    pub type_doc: Option<Cow<'static, str>>,
    pub fields: BTreeMap<Index, Field>,
    pub static_fields: BTreeMap<Index, Field>,
    pub meta_fields: BTreeMap<Index, Field>,
    pub methods: BTreeMap<Index, Func>,
    pub meta_methods: BTreeMap<Index, Func>,
    pub functions: BTreeMap<Index, Func>,
    pub meta_functions: BTreeMap<Index, Func>,
    /* private fields */
}
Expand description

Type information for a lua class. This happens to be a TypedUserData

Fields§

§type_doc: Option<Cow<'static, str>>§fields: BTreeMap<Index, Field>§static_fields: BTreeMap<Index, Field>§meta_fields: BTreeMap<Index, Field>§methods: BTreeMap<Index, Func>§meta_methods: BTreeMap<Index, Func>§functions: BTreeMap<Index, Func>§meta_functions: BTreeMap<Index, Func>

Implementations§

Source§

impl TypedClassBuilder

Source

pub fn new<T: TypedUserData>() -> Self

Source

pub fn is_meta_empty(&self) -> bool

Check if any of there are any meta fields, functions, or methods present

Source

pub fn field( self, key: impl Into<Index>, ty: Type, doc: impl IntoDocComment, ) -> Self

Creates a new typed field and adds it to the class’s type information

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

static NAME: &str = "mlua_extras";

TypedClassBuilder::default()
    .field("data1", Type::string() | Type::nil(), "doc comment goes last")
    .field("data2", Type::array(Type::string()), ()) // Can also use `None` instead of `()`
    .field("message", Type::string(), foramt!("A message for {NAME}"))
Source

pub fn function<Params, Returns>( self, key: impl Into<Index>, doc: impl IntoDocComment, ) -> Self
where Params: TypedMultiValue, Returns: TypedMultiValue,

Creates a new typed function and adds it to the class’s type information

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

TypedClassBuilder::default()
    .function::<String, ()>("greet", "Greet the given name")
    // Can use `None` instead of `()` for specifying the doc comment
    .function::<String, ()>("hello", ())
Source

pub fn function_with<Params, Returns, F, R>( self, key: impl Into<Index>, doc: impl IntoDocComment, generator: F, ) -> Self
where Params: TypedMultiValue, Returns: TypedMultiValue, F: Fn(&mut FunctionBuilder<Params, Returns>) -> R, R: Any,

Same as function but with an extra generator function parameter.

This extra parameter allows for customization of parameter names, types, and doc comments along with return types and doc comments.

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

TypedClassBuilder::default()
    // Can use `None` instead of `()` for specifying the doc comment
    .function_with::<String, String>("getMessage", (), |func| {
        func.param(0, |param| param.name("name").doc("Name to use when constructing the message"));
        func.ret(0, |ret| ret.doc("Message constructed using the provided name"))
    })
Source

pub fn method<Params, Returns>( self, key: impl Into<Index>, doc: impl IntoDocComment, ) -> Self
where Params: TypedMultiValue, Returns: TypedMultiValue,

Creates a new typed method and adds it to the class’s type information.

As with methods in lua, the self parameter is implicit and has the same type as the parent class.

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

TypedClassBuilder::default()
    .method::<String, ()>("greet", "Greet the given name")
    // Can use `None` instead of `()` for specifying the doc comment
    .method::<String, ()>("hello", ())
Source

pub fn method_with<Params, Returns, F, R>( self, key: impl Into<Index>, doc: impl IntoDocComment, generator: F, ) -> Self
where Params: TypedMultiValue, Returns: TypedMultiValue, F: Fn(&mut FunctionBuilder<Params, Returns>) -> R, R: Any,

Same as method but with an extra generator function parameter.

This extra parameter allows for customization of parameter names, types, and doc comments along with return types and doc comments.

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

TypedClassBuilder::default()
    // Can use `None` instead of `()` for specifying the doc comment
    .method_with::<String, String>("getMessage", (), |func| {
        func.param(0, |param| param.name("name").doc("Name to use when constructing the message"));
        func.ret(0, |ret| ret.doc("Message constructed using the provided name"))
    })
Source

pub fn meta_field( self, key: impl Into<Index>, ty: Type, doc: impl IntoDocComment, ) -> Self

Creates a new typed field and adds it to the class’s meta type information

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

static NAME: &str = "mlua_extras";

TypedClassBuilder::default()
    .meta_field("data1", Type::string() | Type::nil(), "doc comment goes last")
    .meta_field("data2", Type::array(Type::string()), ()) // Can also use `None` instead of `()`
    .meta_field("message", Type::string(), foramt!("A message for {NAME}"))
Source

pub fn meta_function<Params, Returns>( self, key: impl Into<Index>, doc: impl IntoDocComment, ) -> Self
where Params: TypedMultiValue, Returns: TypedMultiValue,

Creates a new typed function and adds it to the class’s meta type information

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

TypedClassBuilder::default()
    .meta_function::<String, ()>("greet", "Greet the given name")
    // Can use `None` instead of `()` for specifying the doc comment
    .meta_function::<String, ()>("hello", ())
Source

pub fn meta_function_with<Params, Returns, F, R>( self, key: impl Into<Index>, doc: impl IntoDocComment, generator: F, ) -> Self
where F: Fn(&mut FunctionBuilder<Params, Returns>) -> R, R: Any, Params: TypedMultiValue, Returns: TypedMultiValue,

Same as meta_function but with an extra generator function parameter.

This extra parameter allows for customization of parameter names, types, and doc comments along with return types and doc comments.

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

TypedClassBuilder::default()
    // Can use `None` instead of `()` for specifying the doc comment
    .meta_function_with::<String, String>("getMessage", (), |func| {
        func.param(0, |param| param.name("name").doc("Name to use when constructing the message"));
        func.ret(0, |ret| ret.doc("Message constructed using the provided name"))
    })
Source

pub fn meta_method<Params, Returns>( self, key: impl Into<Index>, doc: impl IntoDocComment, ) -> Self
where Params: TypedMultiValue, Returns: TypedMultiValue,

Creates a new typed method and adds it to the class’s type information.

As with methods in lua, the self parameter is implicit and has the same type as the parent class.

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

static NAME: &str = "mlua_extras";

TypedClassBuilder::default()
    .method::<String, ()>("greet", "Greet the given name")
    // Can use `None` instead of `()` for specifying the doc comment
    .method::<String, ()>("hello", ())
Source

pub fn meta_method_with<Params, Returns, F, R>( self, key: impl Into<Index>, doc: impl IntoDocComment, generator: F, ) -> Self
where F: Fn(&mut FunctionBuilder<Params, Returns>) -> R, R: Any, Params: TypedMultiValue, Returns: TypedMultiValue,

Same as meta_method but with an extra generator function parameter.

This extra parameter allows for customization of parameter names, types, and doc comments along with return types and doc comments.

§Example
use mlua_extras::typed::{TypedClassBuilder, Type};

TypedClassBuilder::default()
    // Can use `None` instead of `()` for specifying the doc comment
    .meta_method_with::<String, String>("getMessage", (), |func| {
        func.param(0, |param| param.name("name").doc("Name to use when constructing the message"));
        func.ret(0, |ret| ret.doc("Message constructed using the provided name"))
    })

Trait Implementations§

Source§

impl Clone for TypedClassBuilder

Source§

fn clone(&self) -> TypedClassBuilder

Returns a duplicate 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 Debug for TypedClassBuilder

Source§

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

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

impl Default for TypedClassBuilder

Source§

fn default() -> TypedClassBuilder

Returns the “default value” for a type. Read more
Source§

impl From<TypedClassBuilder> for Type

Source§

fn from(value: TypedClassBuilder) -> Self

Converts to this type from the input type.
Source§

impl Hash for TypedClassBuilder

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for TypedClassBuilder

Source§

fn cmp(&self, other: &TypedClassBuilder) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for TypedClassBuilder

Source§

fn eq(&self, other: &TypedClassBuilder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for TypedClassBuilder

Source§

fn partial_cmp(&self, other: &TypedClassBuilder) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: TypedUserData> TypedDataDocumentation<T> for TypedClassBuilder

Source§

fn add(&mut self, doc: &str) -> &mut Self

Source§

impl<'lua, T: TypedUserData> TypedDataFields<'lua, T> for TypedClassBuilder

Source§

fn document(&mut self, doc: &str) -> &mut Self

Adds documentation to the next field that gets added
Source§

fn add_field<V>(&mut self, name: impl AsRef<str>, _: V)
where V: IntoLua<'lua> + Clone + 'static + Typed,

Typed version of add_field
Source§

fn add_field_function_set<S, A, F>(&mut self, name: &S, _: F)
where S: AsRef<str> + ?Sized, A: FromLua<'lua> + Typed, F: 'static + MaybeSend + FnMut(&'lua Lua, AnyUserData<'lua>, A) -> Result<()>,

Typed version of add_field_function_set
Source§

fn add_field_function_get<S, R, F>(&mut self, name: &S, _: F)
where S: AsRef<str> + ?Sized, R: IntoLua<'lua> + Typed, F: 'static + MaybeSend + Fn(&'lua Lua, AnyUserData<'lua>) -> Result<R>,

Typed version of add_field_function_get
Source§

fn add_field_function_get_set<S, R, A, GET, SET>( &mut self, name: &S, _: GET, _: SET, )
where S: AsRef<str> + ?Sized, R: IntoLua<'lua> + Typed, A: FromLua<'lua> + Typed, GET: 'static + MaybeSend + Fn(&'lua Lua, AnyUserData<'lua>) -> Result<R>, SET: 'static + MaybeSend + Fn(&'lua Lua, AnyUserData<'lua>, A) -> Result<()>,

Typed version of add_field_function_get and add_field_function_set combined
Source§

fn add_field_method_set<S, A, M>(&mut self, name: &S, _: M)
where S: AsRef<str> + ?Sized, A: FromLua<'lua> + Typed, M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<()>,

Typed version of dd_field_method_set
Source§

fn add_field_method_get<S, R, M>(&mut self, name: &S, _: M)
where S: AsRef<str> + ?Sized, R: IntoLua<'lua> + Typed, M: 'static + MaybeSend + Fn(&'lua Lua, &T) -> Result<R>,

Typed version of add_field_method_get
Source§

fn add_field_method_get_set<S, R, A, GET, SET>( &mut self, name: &S, _: GET, _: SET, )
where S: AsRef<str> + ?Sized, R: IntoLua<'lua> + Typed, A: FromLua<'lua> + Typed, GET: 'static + MaybeSend + Fn(&'lua Lua, &T) -> Result<R>, SET: 'static + MaybeSend + Fn(&'lua Lua, &mut T, A) -> Result<()>,

Typed version of add_field_method_get and add_field_method_set combined
Source§

fn add_meta_field<R, F>(&mut self, meta: MetaMethod, _: F)
where F: 'static + MaybeSend + Fn(&'lua Lua) -> Result<R>, R: IntoLua<'lua> + Typed,

Typed version of add_meta_field
Source§

impl<'lua, T: TypedUserData> TypedDataMethods<'lua, T> for TypedClassBuilder

Source§

fn document(&mut self, documentation: &str) -> &mut Self

Adds documentation to the next method/function that gets added
Source§

fn add_method<S, A, R, M>(&mut self, name: &S, _: M)
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> Result<R>,

Exposes a method to lua
Source§

fn add_method_with<S, A, R, M, G>(&mut self, name: &S, _method: M, generator: G)
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Exposes a method to lua Read more
Source§

fn add_function<S, A, R, F>(&mut self, name: &S, _: F)
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result<R>,

Exposes a function to lua (its a method that does not take Self)
Source§

fn add_function_with<S, A, R, F, G>( &mut self, name: &S, _function: F, generator: G, )
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Exposes a function to lua (its a method that does not take Self) Read more
Source§

fn add_method_mut<S, A, R, M>(&mut self, name: &S, _: M)
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<R>,

Exposes a method to lua that has a mutable reference to Self
Source§

fn add_method_mut_with<S, A, R, M, G>( &mut self, name: &S, _method: M, generator: G, )
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Exposes a method to lua that has a mutable reference to Self Read more
Source§

fn add_meta_method<A, R, M>(&mut self, meta: MetaMethod, _: M)
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> Result<R>,

Exposes a meta method to lua http://lua-users.org/wiki/MetatableEvents
Source§

fn add_meta_method_with<A, R, M, G>( &mut self, meta: MetaMethod, _method: M, generator: G, )
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Source§

fn add_async_method<'s, S: ?Sized + AsRef<str>, A, R, M, MR>( &mut self, name: &S, _: M, )
where T: 'static, M: Fn(&'lua Lua, &'s T, A) -> MR + MaybeSend + 'static, A: FromLuaMulti<'lua> + TypedMultiValue, MR: Future<Output = Result<R>> + 's, R: IntoLuaMulti<'lua> + TypedMultiValue, 'lua: 's,

exposes an async method to lua
Source§

fn add_async_method_with<'s, S: ?Sized + AsRef<str>, A, R, M, MR, G>( &mut self, name: &S, _method: M, generator: G, )
where T: 'static, M: Fn(&'lua Lua, &'s T, A) -> MR + MaybeSend + 'static, A: FromLuaMulti<'lua> + TypedMultiValue, MR: Future<Output = Result<R>> + 's, R: IntoLuaMulti<'lua> + TypedMultiValue, G: Fn(&mut FunctionBuilder<A, R>), 'lua: 's,

exposes an async method to lua Read more
Source§

fn add_async_method_mut<'s, S: ?Sized + AsRef<str>, A, R, M, MR>( &mut self, name: &S, method: M, )
where T: 'static, M: Fn(&'lua Lua, &'s mut T, A) -> MR + MaybeSend + 'static, A: FromLuaMulti<'lua> + TypedMultiValue, MR: Future<Output = Result<R>> + 's, R: IntoLuaMulti<'lua> + TypedMultiValue, 'lua: 's,

exposes an async method to lua
Source§

fn add_async_method_mut_with<'s, S: ?Sized + AsRef<str>, A, R, M, MR, G>( &mut self, name: &S, _method: M, generator: G, )
where T: 'static, M: Fn(&'lua Lua, &'s mut T, A) -> MR + MaybeSend + 'static, A: FromLuaMulti<'lua> + TypedMultiValue, MR: Future<Output = Result<R>> + 's, R: IntoLuaMulti<'lua> + TypedMultiValue, G: Fn(&mut FunctionBuilder<A, R>), 'lua: 's,

exposes an async method to lua Read more
Source§

fn add_function_mut<S, A, R, F>(&mut self, name: &S, _: F)
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> Result<R>,

Exposes a mutable function to lua
Source§

fn add_function_mut_with<S, A, R, F, G>( &mut self, name: &S, _function: F, generator: G, )
where S: ?Sized + AsRef<str>, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Exposes a mutable function to lua Read more
Source§

fn add_meta_function<A, R, F>(&mut self, meta: MetaMethod, _: F)
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result<R>,

Exposes a meta function to lua http://lua-users.org/wiki/MetatableEvents
Source§

fn add_meta_function_with<A, R, F, G>( &mut self, meta: MetaMethod, _function: F, generator: G, )
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + Fn(&'lua Lua, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Source§

fn add_async_function<S, A, R, F, FR>(&mut self, name: &S, _: F)
where S: AsRef<str> + ?Sized, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + Fn(&'lua Lua, A) -> FR, FR: 'lua + Future<Output = Result<R>>,

exposes an async function to lua
Source§

fn add_async_function_with<S, A, R, F, FR, G>( &mut self, name: &S, _function: F, generator: G, )
where S: AsRef<str> + ?Sized, A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + Fn(&'lua Lua, A) -> FR, FR: 'lua + Future<Output = Result<R>>, G: Fn(&mut FunctionBuilder<A, R>),

exposes an async function to lua Read more
Source§

fn add_meta_method_mut<A, R, M>(&mut self, meta: MetaMethod, _: M)
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<R>,

Exposes a meta and mutable method to lua http://lua-users.org/wiki/MetatableEvents
Source§

fn add_meta_method_mut_with<A, R, M, G>( &mut self, meta: MetaMethod, _method: M, generator: G, )
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Exposes a meta and mutable method to lua http://lua-users.org/wiki/MetatableEvents Read more
Source§

fn add_meta_function_mut<A, R, F>(&mut self, meta: MetaMethod, _: F)
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> Result<R>,

Exposes a meta and mutable function to lua http://lua-users.org/wiki/MetatableEvents
Source§

fn add_meta_function_mut_with<A, R, F, G>( &mut self, meta: MetaMethod, _function: F, generator: G, )
where A: FromLuaMulti<'lua> + TypedMultiValue, R: IntoLuaMulti<'lua> + TypedMultiValue, F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> Result<R>, G: Fn(&mut FunctionBuilder<A, R>),

Exposes a meta and mutable function to lua http://lua-users.org/wiki/MetatableEvents
Source§

impl Eq for TypedClassBuilder

Source§

impl StructuralPartialEq for TypedClassBuilder

Auto Trait Implementations§

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

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