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§
sourcetype TypeConstructor<'target, 'da>: Managed<'target, 'da>
type TypeConstructor<'target, 'da>: Managed<'target, 'da>
Self
, but with arbitrary lifetimes. Used to construct the appropriate type in generic
contexts.
Provided Methods§
sourcefn root<'target, T>(
self,
target: T
) -> T::Data<'data, Self::TypeConstructor<'target, 'data>>where
T: Target<'target>,
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.
sourcefn unrooted_target(self) -> Unrooted<'scope>
fn unrooted_target(self) -> Unrooted<'scope>
Returns a new Unrooted
.
sourcefn display_string(self) -> JlrsResult<String>
fn display_string(self) -> JlrsResult<String>
Convert the data to its display string, i.e. the string that is shown when calling
Base.show
.
sourcefn error_string(self) -> JlrsResult<String>
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
.
sourcefn display_string_or<S: Into<String>>(self, default: S) -> String
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.
sourcefn error_string_or<S: Into<String>>(self, default: S) -> String
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.
sourcefn leak(self) -> Ref<'static, 'data, Self::TypeConstructor<'static, 'data>>
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 ccall
ed function,
and in combination with the ForeignType
trait to store references to Julia data in types
that that implement that trait.