pub struct ConstantDescriptor {
pub name: &'static str,
pub ty: &'static str,
pub value: &'static str,
pub docs: &'static str,
}Expand description
Public-facing program constant.
Mirrors Anchor’s #[constant] IDL surface. Carries the source-level
name, the stringified Rust type, and the stringified initializer
expression, so off-chain consumers can reconstruct the value
without the program crate as a build-time dependency.
Emitted by #[hopper::constant] as a sibling pub const next to
the original declaration; collected into a &'static [ConstantDescriptor]
slice by the program author (or by the hopper::program! macro) and
passed to an IDL emitter via AnchorIdlWithConstants.
Fields§
§name: &'static strConstant name, e.g. "MAX_DEPOSIT".
ty: &'static strStringified Rust type, e.g. "u64" or "[u8; 32]".
value: &'static strStringified initializer expression, e.g. "1_000_000".
docs: &'static strOptional doc-comment text.
Trait Implementations§
Source§impl Clone for ConstantDescriptor
impl Clone for ConstantDescriptor
Source§fn clone(&self) -> ConstantDescriptor
fn clone(&self) -> ConstantDescriptor
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 moreSource§impl Debug for ConstantDescriptor
impl Debug for ConstantDescriptor
impl Copy for ConstantDescriptor
Auto Trait Implementations§
impl Freeze for ConstantDescriptor
impl RefUnwindSafe for ConstantDescriptor
impl Send for ConstantDescriptor
impl Sync for ConstantDescriptor
impl Unpin for ConstantDescriptor
impl UnsafeUnpin for ConstantDescriptor
impl UnwindSafe for ConstantDescriptor
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