pub struct NamespaceId(pub u64);Expand description
ネームスペースの ID。名前と親の ID から決まる。最上位ビットは1。
Tuple Fields§
§0: u64Implementations§
Source§impl NamespaceId
impl NamespaceId
Sourcepub fn generate(parent_id: Option<NamespaceId>, name: &[u8]) -> Self
pub fn generate(parent_id: Option<NamespaceId>, name: &[u8]) -> Self
名前と親の ID から ID を求める。catapult の GenerateNamespaceId と同じく、
親の ID(ルートなら0)と名前を続けた SHA3-256 の先頭8バイトに、モザイクと見分ける最上位ビットを立てて使う。
Sourcepub fn from_full_name(full_name: &str) -> Result<Self, InvalidNamespaceName>
pub fn from_full_name(full_name: &str) -> Result<Self, InvalidNamespaceName>
ドットで区切ったフルネームから ID を求める。公式の SDK の generate_mosaic_alias_id と同じく、
NamespaceId::path の最後の ID。symbol.xym なら、通貨のモザイクに付いているネームスペースになる。
Sourcepub fn path(full_name: &str) -> Result<Vec<Self>, InvalidNamespaceName>
pub fn path(full_name: &str) -> Result<Vec<Self>, InvalidNamespaceName>
ドットで区切ったフルネームを、ルートから順の ID の並びにする。公式の SDK の generate_namespace_path。
どの部分も is_valid_namespace_name を満たさなければならない。
名前の長さと深さの上限はネットワークの設定(maxNameSize と maxNamespaceDepth)で決まるので、ここでは確かめない。
Trait Implementations§
Source§impl Clone for NamespaceId
impl Clone for NamespaceId
Source§fn clone(&self) -> NamespaceId
fn clone(&self) -> NamespaceId
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for NamespaceId
Source§impl Debug for NamespaceId
impl Debug for NamespaceId
impl Eq for NamespaceId
Source§impl From<NamespaceId> for UnresolvedMosaicId
impl From<NamespaceId> for UnresolvedMosaicId
Source§fn from(id: NamespaceId) -> Self
fn from(id: NamespaceId) -> Self
Converts to this type from the input type.
Source§impl Hash for NamespaceId
impl Hash for NamespaceId
Source§impl Ord for NamespaceId
impl Ord for NamespaceId
Source§fn cmp(&self, other: &NamespaceId) -> Ordering
fn cmp(&self, other: &NamespaceId) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for NamespaceId
impl PartialEq for NamespaceId
Source§impl PartialOrd for NamespaceId
impl PartialOrd for NamespaceId
impl StructuralPartialEq for NamespaceId
Auto Trait Implementations§
impl Freeze for NamespaceId
impl RefUnwindSafe for NamespaceId
impl Send for NamespaceId
impl Sync for NamespaceId
impl Unpin for NamespaceId
impl UnsafeUnpin for NamespaceId
impl UnwindSafe for NamespaceId
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