Crate odds [] [src]

Odds and ends — collection miscellania.

  • Utilities for debug-checked, release-unchecked indexing and slicing
  • Fixpoint combinator for closures
  • String and Vec extensions

The odds crate has the following crate feature flags:

  • std
    • Default
    • Requires Rust 1.6 to opt out of
    • Use libstd and std features.
  • unstable.
    • Optional.
    • Requires nightly channel.
    • Implement the closure traits for Fix.

Modules

slice

Extra functions for slices

stride

Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

string

Extensions to &str and String

vec

Extensions to Vec

Structs

Fix

Fixpoint combinator for rust closures, generalized over the return type.

Traits

IndexRange

IndexRange is implemented by Rust's built-in range types, produced by range syntax like .., a.., ..b or c..d.

Functions

debug_assert_unreachable

Act as debug_assert! in debug mode, asserting that this point is not reached.

fix

Fixpoint combinator for rust closures, generalized over the return type.

get_unchecked

Use debug_assert! to check indexing in debug mode. In release mode, no checks are done.

get_unchecked_mut

Use debug_assert! to check indexing in debug mode. In release mode, no checks are done.

ptr_eq

Compare if a and b are equal pointers.

raw_byte_repr

Safe to use with any wholly initialized memory ptr

ref_eq

Compare if a and b are equal as pointers.

ref_slice

Create a length 1 slice out of a reference

ref_slice_mut

Create a length 1 mutable slice out of a reference

slice_unchecked

Check slicing bounds in debug mode, otherwise just act as an unchecked slice call.

slice_unchecked_mut

Check slicing bounds in debug mode, otherwise just act as an unchecked slice call.