pub struct CIP25ChunkableString(/* private fields */);Expand description
A String that may or may not be chunked into 64-byte chunks to be able to conform to Cardano TX Metadata limitations. Most users should simply use CIP25ChunkableString::from_string() and CIP25ChunkableString::to_string() and avoid the explicit single/chunk interface:
let chunkableString = CIP25.CIP25ChunkableString.from_string("this can be any length and will automatically be chunked if needed");Implementations§
Source§impl CIP25ChunkableString
impl CIP25ChunkableString
Sourcepub fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
pub fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
- Serialize this type to CBOR bytes.
- This type does NOT support fine-tuned encoding options so this may or may not be
- canonical CBOR and may or may not preserve round-trip encodings.
Sourcepub fn from_cbor_bytes(
cbor_bytes: &[u8],
) -> Result<CIP25ChunkableString, JsError>
pub fn from_cbor_bytes( cbor_bytes: &[u8], ) -> Result<CIP25ChunkableString, JsError>
- Create this type from CBOR bytes
Sourcepub fn to_cbor_hex(&self) -> String
pub fn to_cbor_hex(&self) -> String
- Serialize this type to CBOR bytes encoded as a hex string (useful for working with CIP30).
- This type does NOT support fine-tuned encoding options so this may or may not be
- canonical CBOR and may or may not preserve round-trip encodings.
Sourcepub fn from_cbor_hex(cbor_bytes: &str) -> Result<CIP25ChunkableString, JsError>
pub fn from_cbor_hex(cbor_bytes: &str) -> Result<CIP25ChunkableString, JsError>
- Create this type from the CBOR bytes encoded as a hex string.
- This is useful for interfacing with CIP30
Source§impl CIP25ChunkableString
impl CIP25ChunkableString
pub fn new_single(single: &CIP25String64) -> Self
pub fn new_chunked(chunked: &CIP25String64List) -> Self
pub fn kind(&self) -> ChunkableStringKind
pub fn as_single(&self) -> Option<CIP25String64>
pub fn as_chunked(&self) -> Option<CIP25String64List>
Trait Implementations§
Source§impl AsRef<CIP25ChunkableString> for CIP25ChunkableString
impl AsRef<CIP25ChunkableString> for CIP25ChunkableString
Source§fn as_ref(&self) -> &CIP25ChunkableString
fn as_ref(&self) -> &CIP25ChunkableString
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for CIP25ChunkableString
impl Clone for CIP25ChunkableString
Source§fn clone(&self) -> CIP25ChunkableString
fn clone(&self) -> CIP25ChunkableString
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CIP25ChunkableString
impl Debug for CIP25ChunkableString
Source§impl From<CIP25ChunkableString> for CIP25ChunkableString
impl From<CIP25ChunkableString> for CIP25ChunkableString
Source§fn from(native: CIP25ChunkableString) -> Self
fn from(native: CIP25ChunkableString) -> Self
Converts to this type from the input type.
Source§impl From<CIP25ChunkableString> for JsValue
impl From<CIP25ChunkableString> for JsValue
Source§fn from(value: CIP25ChunkableString) -> Self
fn from(value: CIP25ChunkableString) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for CIP25ChunkableString
impl FromWasmAbi for CIP25ChunkableString
Source§impl Into<CIP25ChunkableString> for CIP25ChunkableString
impl Into<CIP25ChunkableString> for CIP25ChunkableString
Source§fn into(self) -> CIP25ChunkableString
fn into(self) -> CIP25ChunkableString
Converts this type into the (usually inferred) input type.
Source§impl IntoWasmAbi for CIP25ChunkableString
impl IntoWasmAbi for CIP25ChunkableString
Source§impl RefFromWasmAbi for CIP25ChunkableString
impl RefFromWasmAbi for CIP25ChunkableString
Source§type Anchor = RcRef<CIP25ChunkableString>
type Anchor = RcRef<CIP25ChunkableString>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl VectorFromWasmAbi for CIP25ChunkableString
impl VectorFromWasmAbi for CIP25ChunkableString
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[CIP25ChunkableString]>
Source§impl VectorIntoJsValue for CIP25ChunkableString
impl VectorIntoJsValue for CIP25ChunkableString
fn vector_into_jsvalue(vector: Box<[CIP25ChunkableString]>) -> JsValue
Source§impl VectorIntoWasmAbi for CIP25ChunkableString
impl VectorIntoWasmAbi for CIP25ChunkableString
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[CIP25ChunkableString]>) -> Self::Abi
Source§impl WasmDescribeVector for CIP25ChunkableString
impl WasmDescribeVector for CIP25ChunkableString
impl SupportsConstructor for CIP25ChunkableString
impl SupportsInstanceProperty for CIP25ChunkableString
impl SupportsStaticProperty for CIP25ChunkableString
Auto Trait Implementations§
impl Freeze for CIP25ChunkableString
impl RefUnwindSafe for CIP25ChunkableString
impl Send for CIP25ChunkableString
impl Sync for CIP25ChunkableString
impl Unpin for CIP25ChunkableString
impl UnwindSafe for CIP25ChunkableString
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.