Module uclicious::raw::object

source ·
Expand description

Objects parsed by the parser.

When you are done feeding the parser call ::get_object() method on a parser. This will give you an owned copy of an Object. Difference between Object and ObjectRef - internal reference count is only decreased for Object when dropped.

Cloning

Due to how rust std lib blanket impls work it’s impossible to clone ObjectRef without converting it into owned Object. Object implements clone by increasing reference count of object.

Deep Cloning

It’s possible to create a deep copy of an Object and ObjectRef by calling ObjectRef::deep_copy(). Copy returned by that method is a completly different object with different address in memory.

Equality and Ordering

Literally all objects can be compared. The order:

  1. Type of objects
  2. Size of objects
  3. Content of objects

That means you can compare a string to float, and it will give some result. I’m not sure about usefulness of this, but it is totally possible.

Structs

  • Owned and mutable instance of UCL Object. All methods that do not require mutability should be implemented on ObjectRef instead.
  • An immutable reference to UCL Object structure. Provides most of the libUCL interface for interacting with parser results.

Enums

  • Errors that could be returned by Object or ObjectRef functions.