#[repr(transparent)]pub struct DataType<'scope>(_, _);
Expand description
Julia type information. You can acquire a Value
’s datatype by by calling
Value::datatype
. If a DataType
is concrete and not a subtype of Array
a new instance
can be created with DataType::instantiate
.
Implementations
sourceimpl<'scope> DataType<'scope>
impl<'scope> DataType<'scope>
sourcepub fn type_name(self) -> TypeNameRef<'scope>
pub fn type_name(self) -> TypeNameRef<'scope>
Returns the TypeName
of this type.
sourcepub fn super_type(self) -> DataTypeRef<'scope>
pub fn super_type(self) -> DataTypeRef<'scope>
Returns the super type of this type.
sourcepub fn parameters(self) -> SimpleVectorRef<'scope>
pub fn parameters(self) -> SimpleVectorRef<'scope>
Returns the type parameters of this type.
sourcepub fn n_parameters(self) -> usize
pub fn n_parameters(self) -> usize
Returns the number of type parameters.
sourcepub fn parameter(self, idx: usize) -> Option<ValueRef<'scope, 'static>>
pub fn parameter(self, idx: usize) -> Option<ValueRef<'scope, 'static>>
Returns the type parameter at position idx
, or None
if the index is out of bounds.
sourcepub fn field_types(self) -> SimpleVectorRef<'scope>
pub fn field_types(self) -> SimpleVectorRef<'scope>
Returns the field types of this type.
sourcepub fn field_type(self, idx: usize) -> Option<ValueRef<'scope, 'static>>
pub fn field_type(self, idx: usize) -> Option<ValueRef<'scope, 'static>>
Returns the field type of the field at position idx
, or None
if the index is out of
bounds.
sourcepub unsafe fn field_type_unchecked(self, idx: usize) -> ValueRef<'scope, 'static>
pub unsafe fn field_type_unchecked(self, idx: usize) -> ValueRef<'scope, 'static>
Returns the field type of the field at position idx
without performing a bounds check.
Safety: idx
must be in-bounds.
sourcepub fn field_type_concrete(self, idx: usize) -> Option<ValueRef<'scope, 'static>>
pub fn field_type_concrete(self, idx: usize) -> Option<ValueRef<'scope, 'static>>
Returns the field type of the field at position idx
.
sourcepub fn field_names(self) -> SimpleVectorRef<'scope>
pub fn field_names(self) -> SimpleVectorRef<'scope>
Returns the field names of this type.
sourcepub fn field_name(self, idx: usize) -> Option<Symbol<'scope>>
pub fn field_name(self, idx: usize) -> Option<Symbol<'scope>>
Returns the name of the field at position idx
.
sourcepub fn field_index<N: ToSymbol>(self, field_name: N) -> JlrsResult<usize>
pub fn field_index<N: ToSymbol>(self, field_name: N) -> JlrsResult<usize>
Returns the index of the field with the name field_name
.
sourcepub fn field_index_unchecked<N: ToSymbol>(self, field_name: N) -> i32
pub fn field_index_unchecked<N: ToSymbol>(self, field_name: N) -> i32
Returns the index of the field with the name field_name
, if the field doesn’t exist the
result is -1
.
sourcepub fn field_name_str(self, idx: usize) -> Option<&'scope str>
pub fn field_name_str(self, idx: usize) -> Option<&'scope str>
Returns the name of the field at position idx
.
sourcepub fn instance(self) -> ValueRef<'scope, 'static>
pub fn instance(self) -> ValueRef<'scope, 'static>
Returns the instance if this type is a singleton.
sourcepub fn is_abstract(self) -> bool
pub fn is_abstract(self) -> bool
Returns true if this is an abstract type.
sourcepub fn has_free_type_vars(self) -> bool
pub fn has_free_type_vars(self) -> bool
Returns true if one or more of the type parameters has not been set.
sourcepub fn is_concrete_type(self) -> bool
pub fn is_concrete_type(self) -> bool
Returns true if this type can have instances
sourcepub fn is_dispatch_tuple(self) -> bool
pub fn is_dispatch_tuple(self) -> bool
Returns true if this type is a dispatch, or leaf, tuple type.
sourcepub fn is_inline_alloc(self) -> bool
pub fn is_inline_alloc(self) -> bool
Returns true if a value of this type stores its data inline.
sourcepub fn has_concrete_subtype(self) -> bool
pub fn has_concrete_subtype(self) -> bool
If false, no value will have this type.
sourcepub fn cached_by_hash(self) -> bool
pub fn cached_by_hash(self) -> bool
If true, the type is stored in hash-based set cache (instead of linear cache).
sourceimpl<'scope> DataType<'scope>
impl<'scope> DataType<'scope>
sourcepub fn field_size(self, idx: usize) -> JlrsResult<u32>
pub fn field_size(self, idx: usize) -> JlrsResult<u32>
Returns the size of the field at position idx
in this type.
sourcepub fn field_offset(self, idx: usize) -> JlrsResult<u32>
pub fn field_offset(self, idx: usize) -> JlrsResult<u32>
Returns the offset where the field at position idx
is stored.
sourcepub fn is_pointer_field(self, idx: usize) -> JlrsResult<bool>
pub fn is_pointer_field(self, idx: usize) -> JlrsResult<bool>
Returns true if the field at position idx
is stored as a pointer.
sourcepub fn is_atomic_field(self, idx: usize) -> JlrsResult<bool>
pub fn is_atomic_field(self, idx: usize) -> JlrsResult<bool>
Returns true if the field at position idx
is an atomic field.
sourcepub unsafe fn field_size_unchecked(self, idx: usize) -> u32
pub unsafe fn field_size_unchecked(self, idx: usize) -> u32
Returns the size of the field at position idx
in this type.
Safety: an exception must not be thrown if this method is called from a ccall
ed
function.
sourcepub unsafe fn field_offset_unchecked(self, idx: usize) -> u32
pub unsafe fn field_offset_unchecked(self, idx: usize) -> u32
Returns the offset where the field at position idx
is stored.
Safety: an exception must not be thrown if this method is called from a ccall
ed
function.
sourcepub unsafe fn is_pointer_field_unchecked(self, idx: usize) -> bool
pub unsafe fn is_pointer_field_unchecked(self, idx: usize) -> bool
Returns true if the field at position idx
is stored as a pointer.
Safety: an exception must not be thrown if this method is called from a ccall
ed
function.
sourcepub unsafe fn is_atomic_field_unchecked(self, idx: usize) -> bool
pub unsafe fn is_atomic_field_unchecked(self, idx: usize) -> bool
Returns true if the field at position idx
is an atomic field.
Safety: an exception must not be thrown if this method is called from a ccall
ed
function.
sourcepub fn instantiate<'target, 'value, 'data, V, S>(
self,
scope: S,
values: V
) -> JlrsResult<JuliaResult<'target, 'data>> where
S: PartialScope<'target>,
V: AsRef<[Value<'value, 'data>]>,
pub fn instantiate<'target, 'value, 'data, V, S>(
self,
scope: S,
values: V
) -> JlrsResult<JuliaResult<'target, 'data>> where
S: PartialScope<'target>,
V: AsRef<[Value<'value, 'data>]>,
Create a new instance of this DataType
, using values
to set the fields.
This is essentially a more powerful version of Value::new
that can instantiate
arbitrary concrete DataType
s, at the cost that each of its fields must have already been
allocated as a Value
. This functions returns an error if the given DataType
isn’t
concrete or is an array type. For custom array types you must use Array::new_for
.
sourcepub fn instantiate_unrooted<'global, 'value, 'data, V>(
self,
_: Global<'global>,
values: V
) -> JlrsResult<JuliaResultRef<'global, 'data>> where
V: AsRef<[Value<'value, 'data>]>,
pub fn instantiate_unrooted<'global, 'value, 'data, V>(
self,
_: Global<'global>,
values: V
) -> JlrsResult<JuliaResultRef<'global, 'data>> where
V: AsRef<[Value<'value, 'data>]>,
Create a new instance of this DataType
, using values
to set the fields.
This is essentially a more powerful version of Value::new
that can instantiate
arbitrary concrete DataType
s, at the cost that each of its fields must have already been
allocated as a Value
. This functions returns an error if the given DataType
is not
concrete or an array type. Unlike DataType::instantiate
this method doesn’t root the
allocated value.
sourcepub unsafe fn instantiate_unchecked<'target, 'value, 'data, V, S>(
self,
scope: S,
values: V
) -> JlrsResult<Value<'target, 'data>> where
S: PartialScope<'target>,
V: AsRef<[Value<'value, 'data>]>,
pub unsafe fn instantiate_unchecked<'target, 'value, 'data, V, S>(
self,
scope: S,
values: V
) -> JlrsResult<Value<'target, 'data>> where
S: PartialScope<'target>,
V: AsRef<[Value<'value, 'data>]>,
Create a new instance of this DataType
, using values
to set the fields.
This is essentially a more powerful version of Value::new
that can instantiate
arbitrary concrete DataType
s, at the cost that each of its fields must have already been
allocated as a Value
.
This method performs no checks whether or not the value can be constructed with these values.
Safety: an exception must not be thrown if this method is called from a ccall
ed
function.
sourcepub unsafe fn instantiate_unrooted_unchecked<'global, 'value, 'borrow, V>(
self,
_: Global<'global>,
values: V
) -> ValueRef<'global, 'borrow> where
V: AsRef<[Value<'value, 'borrow>]>,
pub unsafe fn instantiate_unrooted_unchecked<'global, 'value, 'borrow, V>(
self,
_: Global<'global>,
values: V
) -> ValueRef<'global, 'borrow> where
V: AsRef<[Value<'value, 'borrow>]>,
Create a new instance of this DataType
, using values
to set the fields.
This is essentially a more powerful version of Value::new
that can instantiate
arbitrary concrete DataType
s, at the cost that each of its fields must have already been
allocated as a Value
.
This method performs no checks whether or not the value can be constructed with these values.
Safety: an exception must not be thrown if this method is called from a ccall
ed
function.
pub fn has_pointer_fields(self) -> JlrsResult<bool>
sourceimpl<'base> DataType<'base>
impl<'base> DataType<'base>
sourcepub fn typeofbottom_type(_: Global<'base>) -> Self
pub fn typeofbottom_type(_: Global<'base>) -> Self
The type of the bottom type, Union{}
.
sourcepub fn datatype_type(_: Global<'base>) -> Self
pub fn datatype_type(_: Global<'base>) -> Self
The type DataType
.
sourcepub fn uniontype_type(_: Global<'base>) -> Self
pub fn uniontype_type(_: Global<'base>) -> Self
The type Union
.
sourcepub fn unionall_type(_: Global<'base>) -> Self
pub fn unionall_type(_: Global<'base>) -> Self
The type UnionAll
.
sourcepub fn typename_type(_: Global<'base>) -> Self
pub fn typename_type(_: Global<'base>) -> Self
The type TypeName
.
sourcepub fn symbol_type(_: Global<'base>) -> Self
pub fn symbol_type(_: Global<'base>) -> Self
The type Symbol
.
sourcepub fn ssavalue_type(_: Global<'base>) -> Self
pub fn ssavalue_type(_: Global<'base>) -> Self
The type SSAValue
.
sourcepub fn abstractslot_type(_: Global<'base>) -> Self
pub fn abstractslot_type(_: Global<'base>) -> Self
The type Slot
.
sourcepub fn slotnumber_type(_: Global<'base>) -> Self
pub fn slotnumber_type(_: Global<'base>) -> Self
The type SlotNumber
.
sourcepub fn typedslot_type(_: Global<'base>) -> Self
pub fn typedslot_type(_: Global<'base>) -> Self
The type TypedSlot
.
sourcepub fn argument_type(_: Global<'base>) -> Self
pub fn argument_type(_: Global<'base>) -> Self
The type Core.Argument
sourcepub fn const_type(_: Global<'base>) -> Self
pub fn const_type(_: Global<'base>) -> Self
The type Core.Const
sourcepub fn partial_struct_type(_: Global<'base>) -> Self
pub fn partial_struct_type(_: Global<'base>) -> Self
The type Core.PartialStruct
sourcepub fn partial_opaque_type(_: Global<'base>) -> Self
pub fn partial_opaque_type(_: Global<'base>) -> Self
The type Core.PartialOpaque
sourcepub fn interconditional_type(_: Global<'base>) -> Self
pub fn interconditional_type(_: Global<'base>) -> Self
The type Core.InterConditional
sourcepub fn method_match_type(_: Global<'base>) -> Self
pub fn method_match_type(_: Global<'base>) -> Self
The type MethodMatch
sourcepub fn simplevector_type(_: Global<'base>) -> Self
pub fn simplevector_type(_: Global<'base>) -> Self
The type SimpleVector
.
sourcepub fn anytuple_type(_: Global<'base>) -> Self
pub fn anytuple_type(_: Global<'base>) -> Self
The type Tuple
.
sourcepub fn emptytuple_type(_: Global<'base>) -> Self
pub fn emptytuple_type(_: Global<'base>) -> Self
The type of an empty tuple.
sourcepub fn tuple_type(_: Global<'base>) -> Self
pub fn tuple_type(_: Global<'base>) -> Self
The type Tuple
.
sourcepub fn vararg_type(_: Global<'base>) -> Self
pub fn vararg_type(_: Global<'base>) -> Self
The type Vararg
.
sourcepub fn function_type(_: Global<'base>) -> Self
pub fn function_type(_: Global<'base>) -> Self
The type Function
.
sourcepub fn builtin_type(_: Global<'base>) -> Self
pub fn builtin_type(_: Global<'base>) -> Self
The type Builtin
.
sourcepub fn method_instance_type(_: Global<'base>) -> Self
pub fn method_instance_type(_: Global<'base>) -> Self
The type MethodInstance
.
sourcepub fn code_instance_type(_: Global<'base>) -> Self
pub fn code_instance_type(_: Global<'base>) -> Self
The type CodeInstance
.
sourcepub fn code_info_type(_: Global<'base>) -> Self
pub fn code_info_type(_: Global<'base>) -> Self
The type CodeInfo
.
sourcepub fn method_type(_: Global<'base>) -> Self
pub fn method_type(_: Global<'base>) -> Self
The type Method
.
sourcepub fn module_type(_: Global<'base>) -> Self
pub fn module_type(_: Global<'base>) -> Self
The type Module
.
sourcepub fn weakref_type(_: Global<'base>) -> Self
pub fn weakref_type(_: Global<'base>) -> Self
The type WeakRef
.
sourcepub fn abstractstring_type(_: Global<'base>) -> Self
pub fn abstractstring_type(_: Global<'base>) -> Self
The type AbstractString
.
sourcepub fn string_type(_: Global<'base>) -> Self
pub fn string_type(_: Global<'base>) -> Self
The type String
.
sourcepub fn errorexception_type(_: Global<'base>) -> Self
pub fn errorexception_type(_: Global<'base>) -> Self
The type ErrorException
.
sourcepub fn argumenterror_type(_: Global<'base>) -> Self
pub fn argumenterror_type(_: Global<'base>) -> Self
The type ArgumentError
.
sourcepub fn loaderror_type(_: Global<'base>) -> Self
pub fn loaderror_type(_: Global<'base>) -> Self
The type LoadError
.
sourcepub fn initerror_type(_: Global<'base>) -> Self
pub fn initerror_type(_: Global<'base>) -> Self
The type InitError
.
sourcepub fn typeerror_type(_: Global<'base>) -> Self
pub fn typeerror_type(_: Global<'base>) -> Self
The type TypeError
.
sourcepub fn methoderror_type(_: Global<'base>) -> Self
pub fn methoderror_type(_: Global<'base>) -> Self
The type MethodError
.
sourcepub fn undefvarerror_type(_: Global<'base>) -> Self
pub fn undefvarerror_type(_: Global<'base>) -> Self
The type UndefVarError
.
sourcepub fn atomicerror_type(_: Global<'base>) -> Self
pub fn atomicerror_type(_: Global<'base>) -> Self
The type Core.AtomicError
.
sourcepub fn lineinfonode_type(_: Global<'base>) -> Self
pub fn lineinfonode_type(_: Global<'base>) -> Self
The type LineInfoNode
.
sourcepub fn boundserror_type(_: Global<'base>) -> Self
pub fn boundserror_type(_: Global<'base>) -> Self
The type BoundsError
.
sourcepub fn uint8_type(_: Global<'base>) -> Self
pub fn uint8_type(_: Global<'base>) -> Self
The type UInt8
.
sourcepub fn int16_type(_: Global<'base>) -> Self
pub fn int16_type(_: Global<'base>) -> Self
The type Int16
.
sourcepub fn uint16_type(_: Global<'base>) -> Self
pub fn uint16_type(_: Global<'base>) -> Self
The type UInt16
.
sourcepub fn int32_type(_: Global<'base>) -> Self
pub fn int32_type(_: Global<'base>) -> Self
The type Int32
.
sourcepub fn uint32_type(_: Global<'base>) -> Self
pub fn uint32_type(_: Global<'base>) -> Self
The type UInt32
.
sourcepub fn int64_type(_: Global<'base>) -> Self
pub fn int64_type(_: Global<'base>) -> Self
The type Int64
.
sourcepub fn uint64_type(_: Global<'base>) -> Self
pub fn uint64_type(_: Global<'base>) -> Self
The type UInt64
.
sourcepub fn float16_type(_: Global<'base>) -> Self
pub fn float16_type(_: Global<'base>) -> Self
The type Float16
.
sourcepub fn float32_type(_: Global<'base>) -> Self
pub fn float32_type(_: Global<'base>) -> Self
The type Float32
.
sourcepub fn float64_type(_: Global<'base>) -> Self
pub fn float64_type(_: Global<'base>) -> Self
The type Float64
.
sourcepub fn floatingpoint_type(_: Global<'base>) -> Self
pub fn floatingpoint_type(_: Global<'base>) -> Self
The type AbstractFloat
.
sourcepub fn number_type(_: Global<'base>) -> Self
pub fn number_type(_: Global<'base>) -> Self
The type Number
.
sourcepub fn nothing_type(_: Global<'base>) -> Self
pub fn nothing_type(_: Global<'base>) -> Self
The type Nothing
.
sourcepub fn signed_type(_: Global<'base>) -> Self
pub fn signed_type(_: Global<'base>) -> Self
The type Signed
.
sourcepub fn voidpointer_type(_: Global<'base>) -> Self
pub fn voidpointer_type(_: Global<'base>) -> Self
The type Ptr{Nothing}
.
sourcepub fn globalref_type(_: Global<'base>) -> Self
pub fn globalref_type(_: Global<'base>) -> Self
The type GlobalRef
.
sourcepub fn linenumbernode_type(_: Global<'base>) -> Self
pub fn linenumbernode_type(_: Global<'base>) -> Self
The type LineNumberNode
.
sourcepub fn gotonode_type(_: Global<'base>) -> Self
pub fn gotonode_type(_: Global<'base>) -> Self
The type GotoNode
.
sourcepub fn gotoifnot_type(_: Global<'base>) -> Self
pub fn gotoifnot_type(_: Global<'base>) -> Self
The type GotoIfNot
.
sourcepub fn returnnode_type(_: Global<'base>) -> Self
pub fn returnnode_type(_: Global<'base>) -> Self
The type ReturnNode
.
sourcepub fn phinode_type(_: Global<'base>) -> Self
pub fn phinode_type(_: Global<'base>) -> Self
The type PhiNode
.
sourcepub fn pinode_type(_: Global<'base>) -> Self
pub fn pinode_type(_: Global<'base>) -> Self
The type PiNode
.
sourcepub fn phicnode_type(_: Global<'base>) -> Self
pub fn phicnode_type(_: Global<'base>) -> Self
The type PhiCNode
.
sourcepub fn upsilonnode_type(_: Global<'base>) -> Self
pub fn upsilonnode_type(_: Global<'base>) -> Self
The type UpsilonNode
.
sourcepub fn quotenode_type(_: Global<'base>) -> Self
pub fn quotenode_type(_: Global<'base>) -> Self
The type QuoteNode
.
sourcepub fn newvarnode_type(_: Global<'base>) -> Self
pub fn newvarnode_type(_: Global<'base>) -> Self
The type NewVarNode
.
sourcepub fn intrinsic_type(_: Global<'base>) -> Self
pub fn intrinsic_type(_: Global<'base>) -> Self
The type Intrinsic
.
sourcepub fn methtable_type(_: Global<'base>) -> Self
pub fn methtable_type(_: Global<'base>) -> Self
The type MethodTable
.
sourcepub fn typemap_level_type(_: Global<'base>) -> Self
pub fn typemap_level_type(_: Global<'base>) -> Self
The type TypeMapLevel
.
sourcepub fn typemap_entry_type(_: Global<'base>) -> Self
pub fn typemap_entry_type(_: Global<'base>) -> Self
The type TypeMapEntry
.
Trait Implementations
impl<'scope> Copy for DataType<'scope>
impl<'scope> Eq for DataType<'scope>
impl<'frame> Typecheck for DataType<'frame>
Auto Trait Implementations
impl<'scope> RefUnwindSafe for DataType<'scope>
impl<'scope> !Send for DataType<'scope>
impl<'scope> !Sync for DataType<'scope>
impl<'scope> Unpin for DataType<'scope>
impl<'scope> UnwindSafe for DataType<'scope>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<'scope, 'data, W> Wrapper<'scope, 'data> for W where
W: WrapperPriv<'scope, 'data>,
impl<'scope, 'data, W> Wrapper<'scope, 'data> for W where
W: WrapperPriv<'scope, 'data>,
sourcefn display_string(self) -> JlrsResult<String>
fn display_string(self) -> JlrsResult<String>
Convert the wrapper to its display string, i.e. the string that is shown when calling
Base.show
. Read more
sourcefn error_string(self) -> JlrsResult<String>
fn error_string(self) -> JlrsResult<String>
Convert the wrapper 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
, AsyncJulia::error_color
, or AsyncJulia::try_error_color
, . Read more