pub struct ObjectId(/* private fields */);Expand description
An ObjectId is a 32-byte identifier used to uniquely identify an object on
the IOTA blockchain.
§Relationship to Address
Addresses and ObjectIds share the same 32-byte addressable space but
are derived leveraging different domain-separator values to ensure,
cryptographically, that there won’t be any overlap, e.g. there can’t be a
valid Object whose ObjectId is equal to that of the Address of a user
account.
§BCS
An ObjectId’s BCS serialized form is defined by the following:
object-id = 32*OCTETImplementations§
Source§impl ObjectId
impl ObjectId
Sourcepub fn derive_id(digest: Digest, count: u64) -> Self
Available on crate feature hash only.
pub fn derive_id(digest: Digest, count: u64) -> Self
hash only.Create an ObjectId from a transaction digest and count.
count is the number of objects that have been created during a
transactions.
Sourcepub fn derive_dynamic_child_id(
&self,
key_type_tag: &TypeTag,
key_bytes: &[u8],
) -> Self
Available on crate features hash and serde only.
pub fn derive_dynamic_child_id( &self, key_type_tag: &TypeTag, key_bytes: &[u8], ) -> Self
hash and serde only.Derive an ObjectId for a Dynamic Child Object.
hash(parent || len(key) || key || key_type_tag)
Source§impl ObjectId
impl ObjectId
pub const LENGTH: usize = 32usize
pub const ZERO: Self
pub const SYSTEM: Self
pub const CLOCK: Self
Sourcepub const fn new(bytes: [u8; 32]) -> Self
pub const fn new(bytes: [u8; 32]) -> Self
Generates a new ObjectId from the provided byte array.
Sourcepub fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, AddressParseError>
pub fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, AddressParseError>
Parse an ObjectId from a hex string.
Sourcepub const fn into_inner(self) -> [u8; 32]
pub const fn into_inner(self) -> [u8; 32]
Returns the underlying byte array of an ObjectId.
Sourcepub const fn inner(&self) -> &[u8; 32]
pub const fn inner(&self) -> &[u8; 32]
Returns a reference to the underlying byte array of an ObjectId.
Sourcepub const fn as_address(&self) -> &Address
pub const fn as_address(&self) -> &Address
Returns the underlying Address of an ObjectId.
Trait Implementations§
Source§impl Arbitrary for ObjectId
impl Arbitrary for ObjectId
Source§type Parameters = ()
type Parameters = ()
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = BoxedStrategy<ObjectId>
type Strategy = BoxedStrategy<ObjectId>
Strategy used to generate values of type Self.Source§fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
fn arbitrary_with(args: <Self as Arbitrary>::Parameters) -> Self::Strategy
Source§impl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ObjectId
impl JsonSchema for ObjectId
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Ord for ObjectId
impl Ord for ObjectId
Source§impl PartialOrd for ObjectId
impl PartialOrd for ObjectId
impl Copy for ObjectId
impl Eq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
impl Freeze for ObjectId
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnwindSafe for ObjectId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)