Octonary utilities. https://crates.io/crates/oct/
Find a file
2026-03-10 12:34:31 +01:00
oct Specify missing 'Cow' specification; 2026-03-10 12:34:31 +01:00
oct-macros Specify 'usize' and 'isize' serialisation; Update docs; Add 'Read' and 'Write' traits to 'serdes'; Do not require 'std' for SerDes; Add 'Error' error type to 'serdes'; Add 'Result' type alias to 'serdes'; Update tests; Implement 'Serialise' and 'MaxSerialisedSize' for references-to-unsized; Implement 'Serialise', 'Deserialise', and 'MaxSerialisedSize' for 'OnceCell'; Implement 'Serialise' and 'MaxSerialisedSize' for 'cell::Ref' and 'cell::RefMut'; Add 'serialise_iter' function to 'serdes'; Implement 'Serialise' and 'MaxSerialisedSize' for mutable references; Implement 'Serialise' and 'MaxSerialisedSize' for 'VecDeque'; Implement 'Serialise', 'Deserialise', and 'MaxSerialisedSize' for 'simd::Mask'; Implement 'Serialise', 'Deserialise', and 'MaxSerialisedSize' for 'cmp::Ordering'; Implement 'Serialise', 'Deserialise', and 'MaxSerialisedSize' for 'Reverse'; Implement 'Serialise', 'Deserialise', and 'MaxSerialisedSize' for 'Cursor'; Implement 'Serialise', 'Deserialise', and 'MaxSerialisedSize' for 'OnceLock'; Implement 'Serialise', 'Deserialise', and 'MaxSerialisedSize' for 'Shutdown'; Fix 'MaxSerialisedSize' implementations for 'rc::Weak' and 'sync::Weak'; Rename 'FromOctets::oned' to 'new_oned'; Specify compatible serialisations; Implement 'Deserialise' for 'Cow<'_, B>' where 'B: ?Sized'; Precise semantics for SerDes on error; 2026-03-09 12:41:14 +01:00
.gitignore Update docs; Fix licence notices; 2026-01-15 12:10:02 +01:00
Cargo.toml Specify missing 'Cow' specification; 2026-03-10 12:34:31 +01:00
CHANGELOG.md Specify missing 'Cow' specification; 2026-03-10 12:34:31 +01:00
clippy.toml Update readme; Decrease Rust version to 1.85; Add 'serdes' feature; Rewrite documentation; Refactor and rewrite code; Add 'new_zeroed_boxed' and 'new_zeroed_boxed_with_metadata' functions to 'Zeroable'; Fix '<[_] as Outlay>::classify_size' panics and unsoundness for large sizes; Rework 'Outlay::size_with_metadata' as 'layout_for_metadata'; Update tests; Add 'ptr_dangling_with_metadata' and 'ptr_dangling_with_metadata_mut' functions to 'Outlay'; Rename 'Zeroable::zeroed' to 'new_zeroed'; Require 'Self: Init' for 'mut_from_octets' and 'mut_from_octets_with_len'; Add 'transmute_ref_with_metadata' and 'transmute_mut_with_metadata' functions; Rework 'FromOctets::ref_from_octets_with_len' as 'ref_from_octets_with_metadata'; Rework 'FromOctets::mut_from_octets_with_len' as 'mut_from_octets_with_metadata'; Remove 'Slice' trait; Add 'non_null_dangling_with_metadata' function to 'Outlay'; Unimplement 'Init' for reference types; Update bounds for 'Outlay::Metadata'; Add 'MaxSerialisedSize' trait to 'serdes'; Add 'write_within_capacity' method to 'Slot'; Add 'MaxSerialisedSize' derive macro; 2026-03-03 11:55:41 +01:00
DOC-ICON.svg Update copyright years; 2026-01-11 17:39:44 +01:00
LICENCE-APACHE.txt Add 'Serialise' and 'Deserialise' derive macros to 'io'; Add 'Immutable' derive macro; Add 'get_ref' and 'get_mut' methods to 'Cursor'; Require 'T: Sized' for 'Cursor<T>'; Implement 'Default' for 'Cursor'; Implement 'PartialEq' and 'Eq' for 'Cursor'; Add 'Repeat' type to 'io'; Add 'repeat' function to 'io'; Add 'read_to_string' function to 'io'; Add 'read_to_string' and 'read_to_end' methods to 'Read'; Add 'copy' function to 'io'; Update docs; Update tests; Relicense under 'MIT OR Apache-2.0'; Add 'other' constructor to 'io::Error'; Optimise 'io::Error'; Add 'SimpleError' type to 'io'; Add 'new' constructor to 'io::SimpleError'; Add 'kind' and 'message' methods to 'io::SimpleError'; 2025-12-20 21:52:08 +01:00
LICENCE-MIT.txt Update copyright years; 2026-01-11 17:39:44 +01:00
LOGO.svg Update copyright years; 2026-01-11 17:39:44 +01:00
README.md Update readme; Decrease Rust version to 1.85; Add 'serdes' feature; Rewrite documentation; Refactor and rewrite code; Add 'new_zeroed_boxed' and 'new_zeroed_boxed_with_metadata' functions to 'Zeroable'; Fix '<[_] as Outlay>::classify_size' panics and unsoundness for large sizes; Rework 'Outlay::size_with_metadata' as 'layout_for_metadata'; Update tests; Add 'ptr_dangling_with_metadata' and 'ptr_dangling_with_metadata_mut' functions to 'Outlay'; Rename 'Zeroable::zeroed' to 'new_zeroed'; Require 'Self: Init' for 'mut_from_octets' and 'mut_from_octets_with_len'; Add 'transmute_ref_with_metadata' and 'transmute_mut_with_metadata' functions; Rework 'FromOctets::ref_from_octets_with_len' as 'ref_from_octets_with_metadata'; Rework 'FromOctets::mut_from_octets_with_len' as 'mut_from_octets_with_metadata'; Remove 'Slice' trait; Add 'non_null_dangling_with_metadata' function to 'Outlay'; Unimplement 'Init' for reference types; Update bounds for 'Outlay::Metadata'; Add 'MaxSerialisedSize' trait to 'serdes'; Add 'write_within_capacity' method to 'Slot'; Add 'MaxSerialisedSize' derive macro; 2026-03-03 11:55:41 +01:00

Oct

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 © 20242026 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