Struct gdnative_core::export::ArgBuilder
source · pub struct ArgBuilder<'r, 'a, T> { /* private fields */ }
Expand description
Builder for providing additional argument information for error reporting.
Implementations§
source§impl<'r, 'a, T> ArgBuilder<'r, 'a, T>
impl<'r, 'a, T> ArgBuilder<'r, 'a, T>
sourcepub fn with_name<S: Into<Cow<'a, str>>>(self, name: S) -> Self
pub fn with_name<S: Into<Cow<'a, str>>>(self, name: S) -> Self
Provides a name for this argument. If an old name is already set, it is silently replaced. The name can either be borrowed from the environment or owned.
sourcepub fn with_type_name<S: Into<Cow<'a, str>>>(self, ty: S) -> Self
pub fn with_type_name<S: Into<Cow<'a, str>>>(self, ty: S) -> Self
Provides a more readable type name for this argument. If an old name is
already set, it is silently replaced. If no type name is given, a value
from std::any::type_name
is used. The name can either be borrowed from
the environment or owned.
source§impl<'r, 'a, T: FromVariant> ArgBuilder<'r, 'a, T>
impl<'r, 'a, T: FromVariant> ArgBuilder<'r, 'a, T>
sourcepub fn get(self) -> Result<T, ArgumentError<'a>>
pub fn get(self) -> Result<T, ArgumentError<'a>>
Get the converted argument value.
Errors
If the argument is missing, or cannot be converted to the desired type.
sourcepub fn get_optional(self) -> Result<Option<T>, ArgumentError<'a>>
pub fn get_optional(self) -> Result<Option<T>, ArgumentError<'a>>
Get the argument as optional.
Errors
If the argument is present, but cannot be converted to the desired type.