pub struct Otw { /* private fields */ }Expand description
Generic type signaling a one-time-witness type argument.
None of address, module and name are known at compile time, only that there are no type parameters.
Use this when you want to instantiate a datatype like Balance<phantom T> that expects its
type argument to be a Move one-time-witness.
§Examples
use moverox::Otw;
use moverox::traits::{MoveDatatype, MoveType};
use serde::{Deserialize, Serialize};
#[derive(MoveDatatype, Clone, Debug, Default, Deserialize, Serialize, PartialEq, Eq, Hash)]
#[move_(address = "0x2", module = balance)]
pub struct Balance<T> {
value: u64,
_otw: std::marker::PhantomData<T>,
}
let address = "0x2".parse().unwrap();
let module = "sui".parse().unwrap();
let name = "SUI".parse().unwrap();
let sui_type = Otw::type_tag(address, module, name);
let balance_type = Balance::<Otw>::type_tag(sui_type);Implementations§
Source§impl Otw
impl Otw
Sourcepub const fn type_tag(
address: Address,
module: Identifier,
name: Identifier,
) -> OtwTypeTag
pub const fn type_tag( address: Address, module: Identifier, name: Identifier, ) -> OtwTypeTag
Create this type’s specialized type tag.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Otw
impl<'de> Deserialize<'de> for Otw
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl MoveDatatype for Otw
impl MoveDatatype for Otw
type StructTag = OtwTypeTag
impl Eq for Otw
impl StructuralPartialEq for Otw
Auto Trait Implementations§
impl Freeze for Otw
impl RefUnwindSafe for Otw
impl Send for Otw
impl Sync for Otw
impl Unpin for Otw
impl UnwindSafe for Otw
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