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: ObjectId
Sourcepub const fn new(bytes: [u8; 32]) -> ObjectId
pub const fn new(bytes: [u8; 32]) -> ObjectId
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ObjectId
impl<'de> Deserialize<'de> for ObjectId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ObjectId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ObjectId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for ObjectId
impl Ord for ObjectId
Source§impl PartialOrd for ObjectId
impl PartialOrd for ObjectId
Source§impl Serialize for ObjectId
impl Serialize for ObjectId
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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>,
Encode the hex strict representing
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>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)