Skip to main content

get_code

Function get_code 

Source
pub fn get_code(name: &str) -> Result<u32, Error>
Expand description

Attempts to return a symbol code for a string.

While symbols are described using names when writing our L-System strings and productions, they are represented internally by 32 bit unsigned ints. Given a name of a symbol, this function returns an unsigned int associated with that name.

If the name was previously seen, it will return the same code.

Errors are return in the following cases:

  • The name is empty, or only white space.
  • The locks this function uses are poisoned.

This is a thread safe call.

Returned code values may not be the same between different runs of anything relying on this library.