Skip to main content

Crate oct

Crate oct 

Source
Expand description

Octonary transcoder.

This library provides facilities for safe (and hopefully sound) transmutations of Rust objects, mainly to and from octonary (bytewise) representations. These transformations may be done in two ways:

  • In-place transmutations: Objects can be reinterpret between different types in-place.
  • Serialisations: Objects can also be serialise into a portable representation.

These interfaces are generally safe and are designed so that most programmes can completely avoid any unsafe code. The only unsafe interfaces provided are traits and the low-level transmute_unchecked function.

§Security

Do note that this project is still relatively early in its development. But even with the hundreds of man-hours of development so far, I very much recommend auditing it before using it in production (nevertheless the so-far soundness holes uncovered.) I would not yet use this project in critical systems – although I am confident that it will become realistic to do so at some point.

§Interface stability and versioning

Breaking changes are common, and usage of this library will require continuous maintenance so as to avoid becoming stuck on an unmaintained major release. Nonetheless, core designs are likely to remain more or less the same, and most breakage will be in the form of lesser, syntactical changes, e.g. identifier renaming or parameter reordering.

The octonary format used by serialisations is not stabilised and are not on track to become stabilised. Instead, users should use in-place transmutations or custom serialisers for specific specifications.

Copyright © 2024‐2026 Gabriel Bjørnager Jensen.

This library is distributed under either an MIT licence or version 2.0 of the Apache License, at your option. See LICENCE-MIT.txt and LICENCE-APACHE.txt for more information.

SPDX identifier: MIT OR Apache-2.0

Modules§

serdesserdes
Serialisation/deserialisation facilities.

Traits§

FromOctets
Denotes a type that can represent all octets (bytes).
Immutable
Denotes an interiour-immutable type.
Init
Denotes a type that is always initialised.
IntoOctets
Denotes a type representable as octets (bytes).
Outlay
Denotes an outlayable type.
Zeroable
Denotes a type that is zeroable.

Functions§

transmute
Transmutes an object to another type.
transmute_mut
Transmutes a mutable reference to another type.
transmute_mut_with_metadata
Transmutes a mutable reference to another type, using predefined metadata.
transmute_ref
Transmutes a reference to another type.
transmute_ref_with_metadata
Transmutes a mutable reference to another type, using predefined metadata.
transmute_unchecked
Unsafely transmutes an object to another type.

Derive Macros§

FromOctetsproc_macro
Implements FromOctets for the given type.
Immutableproc_macro
Implements Immutable for the given type.
Zeroableproc_macro
Implements Zeroable for the given type.