Trait jlrs::data::managed::Managed

source ·
pub trait Managed<'scope, 'data>: ManagedPriv<'scope, 'data> {
    type TypeConstructor<'target, 'da>: Managed<'target, 'da>;

    // Provided methods
    fn as_ref(self) -> Ref<'scope, 'data, Self> { ... }
    fn as_value(self) -> Value<'scope, 'data> { ... }
    fn root<'target, T>(
        self,
        target: T
    ) -> T::Data<'data, Self::TypeConstructor<'target, 'data>>
       where T: Target<'target> { ... }
    fn unrooted_target(self) -> Unrooted<'scope> { ... }
    fn display_string(self) -> JlrsResult<String> { ... }
    fn error_string(self) -> JlrsResult<String> { ... }
    fn display_string_or<S: Into<String>>(self, default: S) -> String { ... }
    fn error_string_or<S: Into<String>>(self, default: S) -> String { ... }
    fn leak(self) -> Ref<'static, 'data, Self::TypeConstructor<'static, 'data>> { ... }
}
Expand description

Trait implemented by all managed types.

Required Associated Types§

source

type TypeConstructor<'target, 'da>: Managed<'target, 'da>

Self, but with arbitrary lifetimes. Used to construct the appropriate type in generic contexts.

Provided Methods§

source

fn as_ref(self) -> Ref<'scope, 'data, Self>

Convert the data to a Ref.

source

fn as_value(self) -> Value<'scope, 'data>

Convert the data to a Value.

source

fn root<'target, T>( self, target: T ) -> T::Data<'data, Self::TypeConstructor<'target, 'data>>
where T: Target<'target>,

Use the target to reroot this data.

source

fn unrooted_target(self) -> Unrooted<'scope>

Returns a new Unrooted.

source

fn display_string(self) -> JlrsResult<String>

Convert the data to its display string, i.e. the string that is shown when calling Base.show.

source

fn error_string(self) -> JlrsResult<String>

Convert the data to its error string, i.e. the string that is shown when calling Base.showerror. This string can contain ANSI color codes if this is enabled by calling Julia::error_color or AsyncJulia::error_color.

source

fn display_string_or<S: Into<String>>(self, default: S) -> String

Convert the data to its display string, i.e. the string that is shown by calling Base.display, or some default value.

source

fn error_string_or<S: Into<String>>(self, default: S) -> String

Convert the data to its error string, i.e. the string that is shown when this value is thrown as an exception, or some default value.

source

fn leak(self) -> Ref<'static, 'data, Self::TypeConstructor<'static, 'data>>

Extends the 'scope lifetime to 'static, which allows this managed data to be leaked from a scope.

This method only extends the 'scope lifetime, the 'data lifetime must already be 'static. This method should only be used to return Julia data from a ccalled function, and in combination with the ForeignType trait to store references to Julia data in types that that implement that trait.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'scope, 'data, W> Managed<'scope, 'data> for W
where W: ManagedPriv<'scope, 'data>,

§

type TypeConstructor<'target, 'da> = <W as ManagedPriv<'scope, 'data>>::TypeConstructorPriv<'target, 'da>