A type constructor for contiguous homogeneous arrays ([T; n]).
Method | __eq__ |
Compares the instance for equality with an object. |
Method | __hash__ |
Returns the hash for this value. |
Method | __init__ |
Construct an array of type ty and count count. |
Method | __ne__ |
Compares the instance for equality with an object. |
Method | __str__ |
Returns the nicely printable string representation of this instance. |
Method | is |
Whether the context argument needed by some methods actually has an effect. |
Property | count |
Property: The number of elements in the array. |
Property | inner |
Property: The type of element of the array. |
Method | _construct |
Return the underlying construct instance |
Method | _decode |
Undocumented |
Method | _encode |
Undocumented |
Method | _resolve |
Uses the resolver to return a resolved version of the type, if possible. |
Instance Variable | _count |
Undocumented |
Instance Variable | _inner |
Undocumented |
Inherited from Type
:
Method | description |
The short description of this type. |
Method | parse |
Parses the value of an instance of this type from a raw buffer, possibly depending on the context. |
Method | size |
The minimal number of bytes necessary to hold an instance of this type, possibly depending on the context. |
Method | to |
Build a byte buffer from a value of this type. |
Compares the instance for equality with an object.
- if the object is not an
Array
, it will never be equal to this instance.
Parameters | |
o:object | Undocumented |
Returns | |
bool | Undocumented |
reven2.types._array.RawBuffer
Construct an array of type ty and count count.
Examples
An array of 4 contiguous 64 bits unsigned integers: >>> U64_4 = types.Array(types.U64, 4)
Information
Parameters | |
ty:Type | The type of element in the resulting array type. |
count:int | The number of elements in the resulting array type. |
Raises | |
ValueError | if count < 0. |
Compares the instance for equality with an object.
- if the object is not an
Array
, it will never be equal to this instance.
Parameters | |
o:object | Undocumented |
Returns | |
bool | Undocumented |
Returns the nicely printable string representation of this instance.
Returns | |
str | Undocumented |
Whether the context argument needed by some methods actually has an effect.
Types that return False to this method are context-insensitive types. You can safely pass any object as context parameter (including None) to the methods of such type.
Note that the context-sensitivity of a type may change in the future.
Examples
Getting the size of a type without needing a context for context-insensitive types: >>> types.U32.is_context_sensitive() False >>> types.U32.size_bytes(context=None) 4 >>> array32_12 = types.Array(types.U32, 12) >>> array32_12.is_context_sensitive() False >>> array32_12.size_bytes() # context=None by default 48
Context-sensitive types may raise errors when attempting to get the size without a context: >>> types.USize.is_context_sensitive() True >>> types.USize.size_bytes(context=None) ValueError: Please provide a context when using a context-sensitive type
Returns | |
bool | Undocumented |
reven2.types._type.Type._construct_type
Return the underlying construct instance
Parameters | |
context:_Optional[ | Undocumented |
Returns | |
_construct.core.Construct | Undocumented |
Undocumented
Parameters | |
obj:_Union[ | Undocumented |
_ | Undocumented |
Returns | |
_List | Undocumented |
reven2.types._type.Type._resolve
Uses the resolver to return a resolved version of the type, if possible.
Parameters | |
resolver:BaseTypeResolver | Undocumented |
Returns | |
Type | Undocumented |