pub struct ProgramRegistry { /* private fields */ }Expand description
Bidirectional-ish lookup from program ID to a display label.
Implementations§
Source§impl ProgramRegistry
impl ProgramRegistry
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
A registry pre-loaded with the well-known program IDs.
Sourcepub fn insert(
&mut self,
program_id: impl Into<String>,
label: impl Into<String>,
)
pub fn insert( &mut self, program_id: impl Into<String>, label: impl Into<String>, )
Register or override a label for a program ID.
Sourcepub fn extend_from<I, K, V>(&mut self, entries: I)
pub fn extend_from<I, K, V>(&mut self, entries: I)
Merge labels from configuration, overriding any existing entries.
Sourcepub fn label(&self, program_id: &str) -> Option<&str>
pub fn label(&self, program_id: &str) -> Option<&str>
The known label for a program ID, if any.
Sourcepub fn display_label(&self, program_id: &str) -> String
pub fn display_label(&self, program_id: &str) -> String
A label suitable for display: the known name, or Unknown Program <id>.
Trait Implementations§
Source§impl Clone for ProgramRegistry
impl Clone for ProgramRegistry
Source§fn clone(&self) -> ProgramRegistry
fn clone(&self) -> ProgramRegistry
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 ProgramRegistry
impl Debug for ProgramRegistry
Source§impl Default for ProgramRegistry
impl Default for ProgramRegistry
Source§fn default() -> ProgramRegistry
fn default() -> ProgramRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProgramRegistry
impl RefUnwindSafe for ProgramRegistry
impl Send for ProgramRegistry
impl Sync for ProgramRegistry
impl Unpin for ProgramRegistry
impl UnsafeUnpin for ProgramRegistry
impl UnwindSafe for ProgramRegistry
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