Struct endbasic_core::syms::CallableMetadataBuilder
source · [−]pub struct CallableMetadataBuilder { /* private fields */ }
Expand description
Builder pattern for a callable’s metadata.
Implementations
sourceimpl CallableMetadataBuilder
impl CallableMetadataBuilder
sourcepub fn new(name: &'static str, return_type: VarType) -> Self
pub fn new(name: &'static str, return_type: VarType) -> Self
Constructs a new metadata builder with the minimum information necessary.
All code except tests must populate the whole builder with details. This is enforced at construction time, where we only allow some fields to be missing under the test configuration.
sourcepub fn with_syntax(self, syntax: &'static str) -> Self
pub fn with_syntax(self, syntax: &'static str) -> Self
Sets the syntax specification for this callable. The syntax
is provided as a free-form
string that is expected to use whatever representation suits the function best.
sourcepub fn with_category(self, category: &'static str) -> Self
pub fn with_category(self, category: &'static str) -> Self
Sets the category for this callable. All callables with the same category name will be grouped together in help messages.
sourcepub fn with_description(self, description: &'static str) -> Self
pub fn with_description(self, description: &'static str) -> Self
Sets the description for this callable. The description
is a collection of paragraphs
separated by a single newline character, where the first paragraph is taken as the summary
of the description. The summary must be a short sentence that is descriptive enough to be
understood without further details. Empty lines (paragraphs) are not allowed.
sourcepub fn build(self) -> CallableMetadata
pub fn build(self) -> CallableMetadata
Generates the final CallableMetadata
object, ensuring all values are present.
sourcepub fn test_build(self) -> CallableMetadata
pub fn test_build(self) -> CallableMetadata
Generates the final CallableMetadata
object, ensuring the minimal set of values are
present. Only useful for testing.
Auto Trait Implementations
impl RefUnwindSafe for CallableMetadataBuilder
impl Send for CallableMetadataBuilder
impl Sync for CallableMetadataBuilder
impl Unpin for CallableMetadataBuilder
impl UnwindSafe for CallableMetadataBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more