partial-default 0.1.0

Provides PartialDefault, a trait similar to Default but with fewer guarantees
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 43.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 585.32 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • signalapp/partial-default
    4 6 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jrose-signal github:signalapp:engineering

[PartialDefault] is a trait for giving a type a non-useful default value.

The standard Default trait documents its purpose as providing a "useful" default value. However, some types (such as a Credential) don't have meaningful defaults, and yet there are still uses for a known-initialized value:

PartialDefault satisfies this niche. A type that implements PartialDefault can provide a value that is safe to drop or assign over, but promises nothing else about that value. It provides a derive macro (opt-in, with the derive feature) and is no_std compatible.

License and Contributions

PartialDefault was made to support libsignal, but is available for general use under the AGPLv3. Still, this is meant to be a low-maintenance crate; do not expect active support or progress on feature requests.

Signal does accept external contributions to this project; however, signing a CLA (Contributor License Agreement) is required for all contributions.

Copyright 2023 Signal Messenger, LLC.

The partial-default-derive crate contains code adapted from the rust-smart-default crate, Copyright (c) 2017 Idan Arye, under the MIT license.