[−][src]Trait new_home_application::method::Method
This trait is used for providing basic information about a method struct This can be derived using the derive macro from the new_home_application_macro crate.
Required methods
fn name(&self) -> String
This method provides a name for the method. It is used to identify the method when its called
When using the derive macro the value returned here is a snake_case version of the struct name.
fn description(&self) -> String
Returns a couple words as a description for the method. For more detailed "helpful" info use the help method.
When derived, this field will be filled from the #description
attribute
fn help(&self) -> String
This provides a more detailed overview up to a help for what the method does, and when it does things.
When derived, this field will be filled from the #help
attribute
fn set_arguments(&mut self, arguments: HashMap<String, Value>) -> Result<()>
This method is used to fill the method's arguments fields. These fields can even be a map stored on the method struct.
When used with the derive macro this method is generated automatically and will fill fields
on the struct itself when they are marked as #argument
. For more detailed view, look into
the macro crate.
Errors
An error can be thrown when, for example, an argument is missing in the map or has the wrong type. The error has to contain a helpful message which can be send back to the user.
When derived an error will occur when an argument is missing. The message will contain which field is missing.