pub struct ObjectId(/* private fields */);
Expand description
An ObjectId
is a 32-byte identifier used to uniquely identify an object on the Sui
blockchain.
§Relationship to Address
Address
es and ObjectId
s 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*OCTET
Implementations§
Source§impl ObjectId
impl ObjectId
pub const LENGTH: usize = 32usize
pub const ZERO: 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 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.
Source§impl ObjectId
impl ObjectId
Sourcepub fn derive_id(digest: TransactionDigest, count: u64) -> Self
Available on crate feature hash
only.
pub fn derive_id(digest: TransactionDigest, count: u64) -> Self
hash
only.Create an ObjectId from TransactionDigest
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)
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 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§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moreSource§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> 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
)