pub fn unit<N>(&mut self, name: N) -> Result<(), ContextError>
    where
        N: AsRef<str>,
    {
        if self.unit_type.is_some() {
            return Err(ContextError::UnitAlreadyPresent);
        }

        self.unit_type = Some(ModuleUnitType {
            name: String::from(name.as_ref()).into_boxed_str(),
        });

        Ok(())
    }
/// Construct type information for the `unit` type.
///
/// Registering this allows the given type to be used in Rune scripts when
/// referring to the `unit` type.
///
/// # Examples
///
/// This shows how to register the unit type `()` as `nonstd::unit`.
///
/// ```rust
/// use runestick::Module;
///
/// # fn main() -> runestick::Result<()> {
/// let mut module = Module::with_item(&["nonstd"]);
/// module.unit("unit")?;
/// # Ok(()) }
Construct type information for the `unit` type.
Registering this allows the given type to be used in Rune scripts when
referring to the `unit` type.
Construct type information for the ` unit ` type . Registering this allows the given type to be used in Rune scripts when referring to the ` unit ` type .
pub fn unit<N>(&mut self, name: N) -> Result<(), ContextError>
    where
        N: AsRef<str>,
    {
        if self.unit_type.is_some() {
            return Err(ContextError::UnitAlreadyPresent);
        }
        self.unit_type = Some(ModuleUnitType {
            name: String::from(name.as_ref()).into_boxed_str(),
        });
        Ok(())
    }
pub fn unit < N > ( & mut self , name : N ) -> Result < ( ) , ContextError > where N : AsRef < str > , { if self . unit_type . is_some ( ) { return Err ( ContextError :: UnitAlreadyPresent ) ; } self . unit_type = Some ( ModuleUnitType { name : String :: from ( name . as_ref ( ) ) . into_boxed_str ( ) , } ) ; Ok ( ( ) ) }
Construct type information for the `unit` type.
Construct type information for the ` unit ` type .
&mut self
name
N
&mut self
name
N
examples
This shows how to register the unit type `()` as `nonstd::unit`.

```rust
use runestick::Module.
This shows how to register the unit type ` () ` as ` nonstd :: unit ` . ` ` ` rust use runestick :: Module .
fn main() -> runestick::result<()> {
let mut module = Module::with_item(&["nonstd"]);
module.unit("unit")?.
let mut module = Module :: with_item ( & [ " nonstd " ] ) ; module . unit ( " unit " ) ? .
ok(()) }
None