Skip to main content

HopperAuthoringString

Struct HopperAuthoringString 

Source
pub struct HopperAuthoringString<'a, const N: usize> { /* private fields */ }
Expand description

Lifetime-shaped bounded UTF-8 authoring value.

Hopper account macros accept String<'a, N> as the canonical pretty dynamic-field syntax and lower it into the compact tail model. This wrapper makes the same spelling available to type checkers without changing the owned runtime representation, which remains HopperString<N>.

Implementations§

Source§

impl<'a, const N: usize> HopperAuthoringString<'a, N>

Source

pub const fn empty() -> Self

Source

pub fn from_str(value: &str) -> Result<Self>

Source

pub const fn from_hopper(inner: HopperString<N>) -> Self

Source

pub const fn as_hopper(&self) -> &HopperString<N>

Source

pub fn into_hopper(self) -> HopperString<N>

Source

pub fn set_str(&mut self, value: &str) -> Result<()>

Source

pub fn as_str(&self) -> Result<&str>

Source

pub fn as_bytes(&self) -> &[u8]

Trait Implementations§

Source§

impl<'a, const N: usize> Clone for HopperAuthoringString<'a, N>

Source§

fn clone(&self) -> HopperAuthoringString<'a, N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, const N: usize> Default for HopperAuthoringString<'a, N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, const N: usize> PartialEq for HopperAuthoringString<'a, N>

Source§

fn eq(&self, other: &HopperAuthoringString<'a, N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, const N: usize> TailCodec for HopperAuthoringString<'a, N>

Source§

const MAX_ENCODED_LEN: usize = HopperString<N>::MAX_ENCODED_LEN

Upper bound on the encoded size. Used by generated helpers to verify the account has enough room before invoking encode. Implementors should pick the smallest valid bound. Hopper uses this to pre-size reallocs.
Source§

fn encode(&self, out: &mut [u8]) -> Result<usize>

Serialize self into out. Returns the number of bytes written (always <= MAX_ENCODED_LEN). Fails with AccountDataTooSmall when out.len() < encoded_len.
Source§

fn decode(input: &[u8]) -> Result<(Self, usize)>

Deserialize from input. Returns (value, bytes_consumed). Fails with InvalidAccountData on malformed encoding.
Source§

impl<'a, const N: usize> Copy for HopperAuthoringString<'a, N>

Source§

impl<'a, const N: usize> Eq for HopperAuthoringString<'a, N>

Source§

impl<'a, const N: usize> StructuralPartialEq for HopperAuthoringString<'a, N>

Auto Trait Implementations§

§

impl<'a, const N: usize> Freeze for HopperAuthoringString<'a, N>

§

impl<'a, const N: usize> RefUnwindSafe for HopperAuthoringString<'a, N>

§

impl<'a, const N: usize> Send for HopperAuthoringString<'a, N>

§

impl<'a, const N: usize> Sync for HopperAuthoringString<'a, N>

§

impl<'a, const N: usize> Unpin for HopperAuthoringString<'a, N>

§

impl<'a, const N: usize> UnsafeUnpin for HopperAuthoringString<'a, N>

§

impl<'a, const N: usize> UnwindSafe for HopperAuthoringString<'a, N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TailElement for T