openvariant 0.1.0

A fast, correct implementation of the Open Variant data type
Documentation
#[cfg(not(feature = "simdutf8"))]
use std::str::Utf8Error;

use anyhow::Result;

pub fn is_strictly_increasing<T, I>(arr: I) -> bool
where
    I: Iterator<Item = T>,
    T: Ord,
{
    arr.is_sorted_by(|a, b| a < b)
}

#[cfg(not(feature = "simdutf8"))]
pub const fn parse_utf8(arr: &[u8]) -> Result<&str, Utf8Error> {
    str::from_utf8(arr)
}

#[cfg(feature = "simdutf8")]
pub const fn parse_utf8(arr: &[u8]) -> Result<&str, Utf8Error> {
    simdutf8::basic::from_utf8(arr)
}