#![feature(prelude_import)]
#![doc(html_root_url = "https://docs.rs/fixed_len_str_example/0.2.4/")]
#![no_std]
#![feature(pattern)]
//! This crate contains an example of the struct generated by the procedural macro contained in [fixed_len_str](https://crates.io/crates/fixed_len_str),use that
//! macro instead.
#[prelude_import]
use core::prelude::v1::*;
#[macro_use]
extern crate core;
#[macro_use]
extern crate compiler_builtins;
use fixed_len_str::{fixed_len_str, fixed_len_str_nz};
pub mod fixed_str12 {
    extern crate alloc;
    use alloc::string::String;
    use alloc::vec::Vec;
    use core::fmt::{Debug, Display, Formatter, Result as FmtResult, Write};
    use core::ops::{self, Deref, DerefMut, Index, IndexMut, Add, AddAssign};
    use core::convert::{AsRef, AsMut};
    use core::hash::{Hasher, Hash};
    use core::borrow::{Borrow, BorrowMut};
    use alloc::borrow::Cow;
    use core::default::Default;
    use core::cmp::Ordering;
    use core::str::{Utf8Error, FromStr};
    use core::iter::FromIterator;
    /// A smart pointer to str with a fixed length of 12,which skip zeroes at the end in the deref,
    /// in more performance sensitive situations use the non-zero variant.
    #[repr(transparent)]
    pub struct FixedStr12 {
        array: [u8; 12],
    }
    #[automatically_derived]
    #[allow(unused_qualifications)]
    impl ::core::clone::Clone for FixedStr12 {
        #[inline]
        fn clone(&self) -> FixedStr12 {
            {
                let _: ::core::clone::AssertParamIsClone<[u8; 12]>;
                *self
            }
        }
    }
    #[automatically_derived]
    #[allow(unused_qualifications)]
    impl ::core::marker::Copy for FixedStr12 {}
    impl FixedStr12 {
        /// Creates an FixedStr12 from an array,returning an error at invalid utf8.
        #[inline]
        pub fn new(array: [u8; 12]) -> Result<Self, Utf8Error> {
            let mut index = 0;
            for (i, e) in (&array[..]).iter().rev().enumerate() {
                if *e != 0 {
                    index = 12 - i;
                    break;
                }
            }
            core::str::from_utf8(&array[..index])?;
            Ok(Self { array })
        }
        /// Creates an FixedStr12 without checking if the bytes are valid utf8.
        ///
        /// # Safety
        ///
        /// Ensure to only use this method with valid utf8.
        #[inline]
        pub const unsafe fn new_unchecked(array: [u8; 12]) -> Self {
            Self { array }
        }
        /// Borrow the internal array as an slice.
        #[inline]
        pub fn as_bytes(&self) -> &[u8] {
            &self.array[..]
        }
        /// Borrow the internal array as a mutable slice.
        ///
        /// # Safety
        ///
        /// This is unsafe due to allow modifications that can produce invalid utf8.
        #[inline]
        pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
            &mut self.array[..]
        }
        /// Fill the last spaces in zero of the buffer with a determinated character.Useful when constructing the array with all bytes in
        /// zero and then filling them in an incremental way.
        ///
        /// # Panics
        ///
        /// This will panic on debug if the zero spaces are not sufficient for the non-zero spaces of the character interpreted as
        /// `\[u8; 4\]`.
        #[inline]
        pub fn fill_char(&mut self, character: char) {
            let position = self.array.iter().position(|e| *e == 0u8).unwrap_or(12);
            let character = unsafe { core::mem::transmute::<char, [u8; 4]>(character) };
            if true {
                if !((&self.array[position..]).len()
                    >= character.iter().position(|e| *e == 0u8).unwrap_or(4))
                {
                    :: core :: panicking :: panic ( "assertion failed: (&self.array[position..]).len() >=\n    character.iter().position(|e| *e == 0u8).unwrap_or(4)" )
                };
            };
            for (e, c) in self.array[position..].iter_mut().zip(character.iter()) {
                *e = *c;
            }
        }
        /// Fill the last spaces in zero of the buffer with a determinated string.Useful when constructing the array with all bytes in
        /// zero and then filling them in an incremental way.
        ///
        /// # Panics
        ///
        /// This will panic on debug if the zero spaces are not sufficient for the non-zero spaces of the string interpreted as
        /// `&\[u8\]`.
        #[inline]
        pub fn fill_str<'a, T: Borrow<str> + ?Sized + 'a>(&mut self, s: &'a T) {
            let s = (*s).borrow();
            let position = self.array.iter().position(|e| *e == 0u8).unwrap_or(12);
            if true {
                if !((&self.array[position..]).len()
                    >= s.as_bytes()
                        .iter()
                        .position(|e| *e == 0u8)
                        .unwrap_or(s.len()))
                {
                    :: core :: panicking :: panic ( "assertion failed: (&self.array[position..]).len() >=\n    s.as_bytes().iter().position(|e| *e == 0u8).unwrap_or(s.len())" )
                };
            };
            for (e, c) in self.array[position..].iter_mut().zip(s.as_bytes().iter()) {
                *e = *c;
            }
        }
        /// Convert the FixedStr12 into a vector of bytes.
        #[inline]
        pub fn into_vec(self) -> Vec<u8> {
            let mut buf = Vec::with_capacity(12);
            unsafe {
                self.array.as_ptr().copy_to(buf.as_mut_ptr(), 12);
                buf.set_len(12)
            }
            buf
        }
        /// Turn the FixedStr12 into a string,moving the bytes.
        #[inline]
        pub fn into_string(self) -> String {
            let mut vec = core::mem::ManuallyDrop::new(self.into_vec());
            unsafe { String::from_raw_parts(vec.as_mut_ptr(), vec.len(), vec.capacity()) }
        }
        /// Construct a FixedStr12 from bytes,without checking if it has length 12.
        ///
        /// # Safety
        ///
        /// This will trigger UB on slice's with length different than 12.
        pub unsafe fn from_bytes_unchecked(s: &[u8]) -> Self {
            Self::new_unchecked(*core::mem::transmute_copy::<&'_ [u8], &'_ [u8; 12]>(&s))
        }
        /// Construct a FixedStr12 from a str,without checking if it has length 12.
        ///
        /// # Safety
        ///
        /// This will trigger UB on str's with length different than 12.
        #[inline]
        pub unsafe fn from_str_unchecked<T: Borrow<str> + ?Sized>(s: &T) -> FixedStr12 {
            Self::from_bytes_unchecked((*s).borrow().as_bytes())
        }
    }
    impl Default for FixedStr12 {
        /// The principal responsible of not using the incomplete feature [`const_generics`],a conveniency
        /// for `Self::new_unchecked([0; 12])`,zero it is not utf8 but this is safe because deref skips
        /// all zeroes onwards the last non-zero byte.
        fn default() -> Self {
            Self { array: [0; 12] }
        }
    }
    impl Display for FixedStr12 {
        fn fmt(&self, f: &'_ mut Formatter) -> FmtResult {
            f.write_fmt(::core::fmt::Arguments::new_v1(
                &[""],
                &match (&self.deref(),) {
                    (arg0,) => [::core::fmt::ArgumentV1::new(
                        arg0,
                        ::core::fmt::Display::fmt,
                    )],
                },
            ))
        }
    }
    impl Debug for FixedStr12 {
        fn fmt(&self, f: &mut Formatter) -> FmtResult {
            f.write_fmt(::core::fmt::Arguments::new_v1(
                &[""],
                &match (&self.deref(),) {
                    (arg0,) => [::core::fmt::ArgumentV1::new(arg0, ::core::fmt::Debug::fmt)],
                },
            ))
        }
    }
    impl Deref for FixedStr12 {
        type Target = str;
        #[inline]
        fn deref(&self) -> &Self::Target {
            let mut index = 0;
            for (i, e) in self.as_bytes().iter().rev().enumerate() {
                if *e != 0 {
                    index = 12 - i;
                    break;
                }
            }
            unsafe { core::str::from_utf8_unchecked(&self.array[..index]) }
        }
    }
    impl DerefMut for FixedStr12 {
        #[inline]
        fn deref_mut(&mut self) -> &mut Self::Target {
            let mut index = 0;
            for (i, e) in self.as_bytes().iter().rev().enumerate() {
                if *e != 0 {
                    index = 12 - i;
                    break;
                }
            }
            unsafe { core::str::from_utf8_unchecked_mut(&mut self.array[..index]) }
        }
    }
    impl AsRef<str> for FixedStr12 {
        fn as_ref(&self) -> &str {
            self.deref()
        }
    }
    impl AsMut<str> for FixedStr12 {
        fn as_mut(&mut self) -> &mut str {
            self.deref_mut()
        }
    }
    impl From<&[u8]> for FixedStr12 {
        /// Construct a FixedStr12 from bytes,if it is greater it take 12 bytes,if it is smaller it
        /// will leave the remanining spaces of the FixedStr12 in zero.
        ///
        /// # Panics
        ///
        /// This will panic if the length of `s` is greater than 12 on debug and always at invalid utf8.
        #[inline]
        fn from(s: &[u8]) -> Self {
            if s.len() == 12 {
                unsafe {
                    Self::from_str_unchecked(
                        core::str::from_utf8(s)
                            .expect("slice had invalid utf8 when trying to convert to FixedStr12"),
                    )
                }
            } else if s.len() < 12 {
                let mut fixed_str = FixedStr12::default();
                fixed_str.fill_str(
                    core::str::from_utf8(s)
                        .expect("slice had invalid utf8 when trying to convert to FixedStr12"),
                );
                fixed_str
            } else if true {
                ::core::panicking::panic("the length of the string was greater than 12 on debug")
            } else {
                unsafe {
                    Self::from_str_unchecked(
                        &core::str::from_utf8(s)
                            .expect("slice had invalid utf8 when trying to convert to FixedStr12")
                            [..12],
                    )
                }
            }
        }
    }
    impl From<&str> for FixedStr12 {
        /// Construct a FixedStr12 from a str,if it is greater it take 12 bytes,if it is smaller it
        /// will leave the remanining spaces of the FixedStr12 in zero.
        ///
        /// # Panics
        ///
        /// This will panic if the length of `s` is greater than 12 on debug.
        #[inline]
        fn from(s: &str) -> Self {
            if s.len() == 12 {
                unsafe { Self::from_str_unchecked(s) }
            } else if s.len() < 12 {
                let mut fixed_str = FixedStr12::default();
                fixed_str.fill_str(s);
                fixed_str
            } else if true {
                ::core::panicking::panic("the length of the string was greater than 12 on debug")
            } else {
                unsafe { Self::from_str_unchecked(&s[..12]) }
            }
        }
    }
    impl From<[u8; 12]> for FixedStr12 {
        fn from(a: [u8; 12]) -> Self {
            Self::new(a).expect("Array of 12 has invalid utf8.")
        }
    }
    impl Hash for FixedStr12 {
        fn hash<H: Hasher>(&self, state: &mut H) {
            self.deref().hash(state)
        }
    }
    impl Borrow<str> for FixedStr12 {
        fn borrow(&self) -> &str {
            self.deref()
        }
    }
    impl BorrowMut<str> for FixedStr12 {
        fn borrow_mut(&mut self) -> &mut str {
            self.deref_mut()
        }
    }
    impl<T: Borrow<str> + ?Sized> PartialOrd<T> for FixedStr12 {
        fn partial_cmp(&self, other: &T) -> Option<Ordering> {
            self.deref().partial_cmp((*other).borrow())
        }
    }
    impl Ord for FixedStr12 {
        fn cmp(&self, other: &Self) -> Ordering {
            self.deref().cmp(other.deref())
        }
    }
    impl ops::Index<ops::Range<usize>> for FixedStr12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::Range<usize>) -> &str {
            &self[..][index]
        }
    }
    impl ops::Index<ops::RangeTo<usize>> for FixedStr12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeTo<usize>) -> &str {
            &self[..][index]
        }
    }
    impl ops::Index<ops::RangeFrom<usize>> for FixedStr12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeFrom<usize>) -> &str {
            &self[..][index]
        }
    }
    impl ops::Index<ops::RangeFull> for FixedStr12 {
        type Output = str;
        #[inline]
        fn index(&self, _: ops::RangeFull) -> &str {
            self.deref()
        }
    }
    impl ops::Index<ops::RangeInclusive<usize>> for FixedStr12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeInclusive<usize>) -> &str {
            Index::index(self.deref(), index)
        }
    }
    impl ops::Index<ops::RangeToInclusive<usize>> for FixedStr12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
            Index::index(self.deref(), index)
        }
    }
    impl ops::IndexMut<ops::Range<usize>> for FixedStr12 {
        #[inline]
        fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
            &mut self[..][index]
        }
    }
    impl ops::IndexMut<ops::RangeTo<usize>> for FixedStr12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
            &mut self[..][index]
        }
    }
    impl ops::IndexMut<ops::RangeFrom<usize>> for FixedStr12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
            &mut self[..][index]
        }
    }
    impl ops::IndexMut<ops::RangeFull> for FixedStr12 {
        #[inline]
        fn index_mut(&mut self, _: ops::RangeFull) -> &mut str {
            self.deref_mut()
        }
    }
    impl ops::IndexMut<ops::RangeInclusive<usize>> for FixedStr12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut str {
            IndexMut::index_mut(self.deref_mut(), index)
        }
    }
    impl ops::IndexMut<ops::RangeToInclusive<usize>> for FixedStr12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut str {
            IndexMut::index_mut(self.deref_mut(), index)
        }
    }
    impl Eq for FixedStr12 {}
    impl<T: Borrow<str> + ?Sized> PartialEq<T> for FixedStr12 {
        #[inline]
        fn eq<'a>(&self, other: &'a T) -> bool {
            PartialEq::eq(&self[..], (*other).borrow())
        }
        #[inline]
        fn ne<'a>(&self, other: &'a T) -> bool {
            PartialEq::ne(&self[..], (*other).borrow())
        }
    }
    /// Fill the zero bytes onwards the end with a given string,then returns itself.
    impl<'a, T: Borrow<str> + ?Sized + 'a> Add<&'a T> for FixedStr12 {
        type Output = Self;
        #[inline]
        fn add(mut self, other: &'a T) -> Self {
            self.fill_str(other);
            self
        }
    }
    /// Fill the zero bytes onwards the end with a given string.
    impl<'a, T: Borrow<str> + ?Sized + 'a> AddAssign<&'a T> for FixedStr12 {
        #[inline]
        fn add_assign(&mut self, other: &'a T) {
            self.fill_str(other);
        }
    }
    /// Fill the zero bytes onwards the end with a given char,then returns itself.
    impl Add<char> for FixedStr12 {
        type Output = Self;
        #[inline]
        fn add(mut self, other: char) -> Self {
            self.fill_char(other);
            self
        }
    }
    /// Fill the zero bytes onwards the end with a given char.
    impl AddAssign<char> for FixedStr12 {
        #[inline]
        fn add_assign(&mut self, other: char) {
            self.fill_char(other);
        }
    }
    /// Fill the zero spaces onwards the end with the items of an iterator,doing nothing when
    /// there are no zero bytes onwards the end to replace.
    impl<'a, T: Borrow<str> + ?Sized + 'a> Extend<&'a T> for FixedStr12 {
        fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
            iter.into_iter().for_each(move |s| self.fill_str(s));
        }
    }
    /// Creates a FixedStr12 from an iterator of strings,doing nothing when
    /// there are no zero bytes onwards the end to replace.
    impl<'a, T: Borrow<str> + ?Sized + 'a> FromIterator<&'a T> for FixedStr12 {
        fn from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> Self {
            let mut buf = FixedStr12::default();
            buf.extend(iter);
            buf
        }
    }
    impl FromStr for FixedStr12 {
        type Err = core::convert::Infallible;
        #[inline]
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            Ok(s.into())
        }
    }
    /// Implementation needed for use the macro [`write!`],it stop writing when
    /// there are no zero bytes onwards the end to replace.
    impl Write for FixedStr12 {
        #[inline]
        fn write_str(&mut self, s: &str) -> FmtResult {
            Ok(self.fill_str(s))
        }
        #[inline]
        fn write_char(&mut self, c: char) -> FmtResult {
            Ok(self.fill_char(c))
        }
    }
    use serde::{Serialize, Deserialize, Serializer, Deserializer};
    use serde::de;
    /// Only expanded in the original crate with the feature "serde_support" enabled.
    impl Serialize for FixedStr12 {
        fn serialize<S: Serializer>(&'_ self, serializer: S) -> Result<S::Ok, S::Error> {
            serializer.serialize_str(&self[..])
        }
    }
    struct FixedStr12Visitor;
    impl<'de> de::Visitor<'de> for FixedStr12Visitor {
        type Value = FixedStr12;
        fn expecting<'a>(&'a self, formatter: &'a mut Formatter) -> FmtResult {
            formatter.write_str("a string less or equal to 12 bytes")
        }
        fn visit_str<E: de::Error>(self, s: &'_ str) -> Result<Self::Value, E> {
            if s.len() <= 12 {
                Ok(FixedStr12::from(s))
            } else {
                Err(de::Error::invalid_value(de::Unexpected::Str(s), &self))
            }
        }
    }
    /// Only expanded in the original crate with the feature "serde_support" enabled.
    impl<'de> Deserialize<'de> for FixedStr12 {
        fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
            deserializer.deserialize_str(FixedStr12Visitor)
        }
    }
    use core::str::pattern::{Pattern, Searcher, SearchStep};
    /// A transparent wrapper for a closure or function,used for implement Pattern on it,needed due to the orphan rule.
    ///
    /// This is only expanded with the feature `pattern_pred_support` enabled.   
    #[repr(transparent)]
    pub struct Closure<F: FnMut(FixedStr12) -> bool> {
        pub f: F,
    }
    /// This is only expanded with the feature `pattern_pred_support` enabled.
    impl<F: FnMut(FixedStr12) -> bool> From<F> for Closure<F> {
        fn from(f: F) -> Self {
            Self { f }
        }
    }
    /// This is only expanded with the feature `pattern_pred_support` enabled.
    impl<'a, F: FnMut(FixedStr12) -> bool> Pattern<'a> for Closure<F> {
        type Searcher = FixedStr12PredicateSearcher<'a, F>;
        fn into_searcher(self, haystack: &'a str) -> Self::Searcher {
            FixedStr12PredicateSearcher {
                pattern: self,
                start: 0,
                end: 0,
                haystack,
            }
        }
    }
    /// A Searcher that takes as pattern a predicate which takes FixedStr12.
    ///
    /// As FixedStr12 allows bytes with zeroes and those are stripped in the
    /// [`Deref`](struct.FixedStr12.html#impl-Deref) and [`PartialEq`](struct.FixedStr12.html#impl-PartialEq) implementation
    /// therefore this searcher searchs upon subslices with length *up to 12*,
    /// allowing read all the haystack.
    ///
    /// This is only expanded with the feature `pattern_pred_support` enabled.   
    pub struct FixedStr12PredicateSearcher<'a, F: FnMut(FixedStr12) -> bool> {
        pattern: Closure<F>,
        haystack: &'a str,
        start: usize,
        end: usize,
    }
    /// This is only expanded with the feature `pattern_pred_support` enabled.
    unsafe impl<'a, F: FnMut(FixedStr12) -> bool> Searcher<'a> for FixedStr12PredicateSearcher<'a, F> {
        #[inline]
        fn haystack(&self) -> &'a str {
            &self.haystack
        }
        #[inline]
        fn next(&mut self) -> SearchStep {
            if self.start == self.haystack().len() {
                return SearchStep::Done;
            }
            let pat = unsafe {
                let temp = &self.haystack[self.start..];
                if temp.len() >= 12 {
                    FixedStr12::from_str_unchecked(temp.get_unchecked(..12))
                } else {
                    let mut fixed_str = FixedStr12::default();
                    for i in 0..temp.as_bytes().len() {
                        *fixed_str.as_bytes_mut().get_unchecked_mut(i) =
                            *temp.as_bytes().get_unchecked(i);
                    }
                    fixed_str
                }
            };
            let len = &pat[..].len();
            self.end += len;
            let start_s = self.start;
            self.start = self.end;
            if unsafe { core::mem::transmute_copy::<Closure<F>, F>(&self.pattern) }(pat) {
                SearchStep::Match(start_s, self.end)
            } else {
                SearchStep::Reject(start_s, self.end)
            }
        }
    }
}
pub use fixed_str12::FixedStr12;
pub mod fixed_str_nz12 {
    extern crate alloc;
    use alloc::string::String;
    use alloc::vec::Vec;
    use core::fmt::{Debug, Display, Formatter, Result as FmtResult};
    use core::ops::{self, Deref, DerefMut, Index, IndexMut};
    use core::borrow::{Borrow, BorrowMut};
    use core::convert::{AsRef, AsMut};
    use core::hash::{Hasher, Hash};
    use core::cmp::Ordering;
    use core::str::{Utf8Error, FromStr};
    use core::num::NonZeroU8;
    use core::mem::{transmute, transmute_copy};
    /// A smart pointer to str with a fixed length of 12,which do not allow zeroes,for skip zeroes at
    /// the end use the normal variant.
    #[repr(transparent)]
    pub struct FixedStrNZ12 {
        array: [NonZeroU8; 12],
    }
    #[automatically_derived]
    #[allow(unused_qualifications)]
    impl ::core::clone::Clone for FixedStrNZ12 {
        #[inline]
        fn clone(&self) -> FixedStrNZ12 {
            {
                let _: ::core::clone::AssertParamIsClone<[NonZeroU8; 12]>;
                *self
            }
        }
    }
    #[automatically_derived]
    #[allow(unused_qualifications)]
    impl ::core::marker::Copy for FixedStrNZ12 {}
    impl FixedStrNZ12 {
        /// Creates an FixedStrNZ12 from an array,returning an error at invalid utf8.
        #[inline]
        pub fn new(array: [NonZeroU8; 12]) -> Result<Self, Utf8Error> {
            let fixed_str = Self { array };
            core::str::from_utf8(fixed_str.as_bytes())?;
            Ok(fixed_str)
        }
        /// Creates an FixedStrNZ12 without checking if the bytes are valid utf8.
        ///
        /// # Safety
        ///
        /// Ensure to only use this method with valid utf8.
        #[inline]
        pub const unsafe fn new_unchecked(array: [NonZeroU8; 12]) -> Self {
            Self { array }
        }
        /// Borrow the internal array as an slice.
        #[inline]
        pub fn as_bytes(&self) -> &[u8] {
            unsafe { transmute(&self.array[..]) }
        }
        /// Borrow the internal array as a mutable slice.
        ///
        /// # Safety
        ///
        /// This is unsafe due to allow modifications that can produce invalid utf8.
        #[inline]
        pub unsafe fn as_bytes_mut(&mut self) -> &mut [NonZeroU8] {
            &mut self.array[..]
        }
        /// Convert the FixedStrNZ12 into a vector of bytes.
        #[inline]
        pub fn into_vec(self) -> Vec<NonZeroU8> {
            let mut buf: Vec<NonZeroU8> = Vec::with_capacity(12);
            unsafe {
                self.array.as_ptr().copy_to(buf.as_mut_ptr(), 12);
                buf.set_len(12)
            }
            buf
        }
        /// Turn the FixedStrNZ12 into a string,moving the bytes.
        #[inline]
        pub fn into_string(self) -> String {
            let mut vec = core::mem::ManuallyDrop::new(self.into_vec());
            unsafe {
                String::from_raw_parts(vec.as_mut_ptr() as *mut u8, vec.len(), vec.capacity())
            }
        }
        /// Construct a FixedStrNZ12 from bytes,without checking if it has length 12.
        ///
        /// # Safety
        ///
        /// This will trigger UB on slice's with length different than 12.
        pub unsafe fn from_bytes_unchecked(s: &[NonZeroU8]) -> Self {
            Self::new_unchecked(*core::mem::transmute_copy::<
                &'_ [NonZeroU8],
                &'_ [NonZeroU8; 12],
            >(&s))
        }
        /// Construct a FixedStrNZ12 from a str,without checking if it has length 12.
        ///
        /// # Safety
        ///
        /// This will trigger UB on str's with length different than 12.
        #[inline]
        pub unsafe fn from_str_unchecked<'a, T: Borrow<str> + ?Sized>(s: &'a T) -> FixedStrNZ12 {
            Self::from_bytes_unchecked(transmute_copy(&(*s).borrow().as_bytes()))
        }
    }
    impl Display for FixedStrNZ12 {
        fn fmt(&self, f: &'_ mut Formatter) -> FmtResult {
            f.write_fmt(::core::fmt::Arguments::new_v1(
                &[""],
                &match (&self.deref(),) {
                    (arg0,) => [::core::fmt::ArgumentV1::new(
                        arg0,
                        ::core::fmt::Display::fmt,
                    )],
                },
            ))
        }
    }
    impl Debug for FixedStrNZ12 {
        fn fmt(&self, f: &mut Formatter) -> FmtResult {
            f.write_fmt(::core::fmt::Arguments::new_v1(
                &[""],
                &match (&self,) {
                    (arg0,) => [::core::fmt::ArgumentV1::new(
                        arg0,
                        ::core::fmt::Display::fmt,
                    )],
                },
            ))
        }
    }
    impl Deref for FixedStrNZ12 {
        type Target = str;
        #[inline]
        fn deref(&self) -> &Self::Target {
            unsafe { core::str::from_utf8_unchecked(self.as_bytes()) }
        }
    }
    impl DerefMut for FixedStrNZ12 {
        #[inline]
        fn deref_mut(&mut self) -> &mut Self::Target {
            unsafe { core::str::from_utf8_unchecked_mut(core::mem::transmute(self.as_bytes_mut())) }
        }
    }
    impl AsRef<str> for FixedStrNZ12 {
        fn as_ref(&self) -> &str {
            <Self as Deref>::deref(self)
        }
    }
    impl AsMut<str> for FixedStrNZ12 {
        fn as_mut(&mut self) -> &mut str {
            <Self as DerefMut>::deref_mut(self)
        }
    }
    impl From<&[NonZeroU8]> for FixedStrNZ12 {
        /// Construct a FixedStrNZ12 from bytes non-zero of length greater or equal to 12,if it is
        /// greater will take 12 bytes.
        ///
        /// # Panics
        ///
        /// This will panic if the length of `s` is less than 12 or if it is greater on debug.
        #[inline]
        fn from(s: &[NonZeroU8]) -> Self {
            if s.len() == 12 {
                unsafe {
                    Self::from_str_unchecked(
                        core::str::from_utf8(core::mem::transmute(s))
                            .expect("slice had invalid utf8 when trying to convert to FixedStr12"),
                    )
                }
            } else if s.len() > 12 {
                if true {
                    ::core::panicking::panic(
                        "the length of the string was greater than 12 on debug",
                    )
                }
                unsafe {
                    Self::from_str_unchecked(
                        &core::str::from_utf8(core::mem::transmute(s))
                            .expect("slice had invalid utf8 when trying to convert to FixedStr12")
                            [..12],
                    )
                }
            } else {
                ::core::panicking::panic("the length of the string was less than 12")
            }
        }
    }
    impl From<&str> for FixedStrNZ12 {
        /// Construct a FixedStrNZ12 from a string of length greater or equal to 12,if it is
        /// greater will take 12 bytes so be careful with no ascii letters.
        ///
        /// # Panics
        ///
        /// This will panic if the length of `s` is less than 12 and if it is greater on debug.
        #[inline]
        fn from(s: &str) -> Self {
            if s.len() == 12 {
                unsafe { Self::from_str_unchecked(s) }
            } else if s.len() > 12 {
                if true {
                    ::core::panicking::panic(
                        "the length of the string was greater than 12 on debug",
                    )
                }
                unsafe { Self::from_str_unchecked(&s[..12]) }
            } else {
                ::core::panicking::panic("the length of the string was less than 12")
            }
        }
    }
    impl Eq for FixedStrNZ12 {}
    impl Hash for FixedStrNZ12 {
        fn hash<H: Hasher>(&self, state: &mut H) {
            self.deref().hash(state)
        }
    }
    impl Borrow<str> for FixedStrNZ12 {
        fn borrow(&self) -> &str {
            self.deref()
        }
    }
    impl BorrowMut<str> for FixedStrNZ12 {
        fn borrow_mut(&mut self) -> &mut str {
            self.deref_mut()
        }
    }
    impl<T: Borrow<str> + ?Sized> PartialOrd<T> for FixedStrNZ12 {
        fn partial_cmp(&self, other: &T) -> Option<Ordering> {
            self.deref().partial_cmp((*other).borrow())
        }
    }
    impl Ord for FixedStrNZ12 {
        fn cmp(&self, other: &Self) -> Ordering {
            self.deref().cmp(other.deref())
        }
    }
    impl ops::Index<ops::Range<usize>> for FixedStrNZ12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::Range<usize>) -> &str {
            &self[..][index]
        }
    }
    impl ops::Index<ops::RangeTo<usize>> for FixedStrNZ12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeTo<usize>) -> &str {
            &self[..][index]
        }
    }
    impl ops::Index<ops::RangeFrom<usize>> for FixedStrNZ12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeFrom<usize>) -> &str {
            &self[..][index]
        }
    }
    impl ops::Index<ops::RangeFull> for FixedStrNZ12 {
        type Output = str;
        #[inline]
        fn index(&self, _index: ops::RangeFull) -> &str {
            self.deref()
        }
    }
    impl ops::Index<ops::RangeInclusive<usize>> for FixedStrNZ12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeInclusive<usize>) -> &str {
            Index::index(self.deref(), index)
        }
    }
    impl ops::Index<ops::RangeToInclusive<usize>> for FixedStrNZ12 {
        type Output = str;
        #[inline]
        fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
            Index::index(self.deref(), index)
        }
    }
    impl ops::IndexMut<ops::Range<usize>> for FixedStrNZ12 {
        #[inline]
        fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
            &mut self[..][index]
        }
    }
    impl ops::IndexMut<ops::RangeTo<usize>> for FixedStrNZ12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
            &mut self[..][index]
        }
    }
    impl ops::IndexMut<ops::RangeFrom<usize>> for FixedStrNZ12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
            &mut self[..][index]
        }
    }
    impl ops::IndexMut<ops::RangeFull> for FixedStrNZ12 {
        #[inline]
        fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str {
            self.deref_mut()
        }
    }
    impl ops::IndexMut<ops::RangeInclusive<usize>> for FixedStrNZ12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut str {
            IndexMut::index_mut(self.deref_mut(), index)
        }
    }
    impl ops::IndexMut<ops::RangeToInclusive<usize>> for FixedStrNZ12 {
        #[inline]
        fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut str {
            IndexMut::index_mut(self.deref_mut(), index)
        }
    }
    impl<T: Borrow<str> + ?Sized> PartialEq<T> for FixedStrNZ12 {
        #[inline]
        fn eq<'a>(&self, other: &'a T) -> bool {
            PartialEq::eq(&self[..], (*other).borrow())
        }
        #[inline]
        fn ne<'a>(&self, other: &'a T) -> bool {
            PartialEq::ne(&self[..], (*other).borrow())
        }
    }
    impl FromStr for FixedStrNZ12 {
        type Err = core::convert::Infallible;
        #[inline]
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            Ok(s.into())
        }
    }
    use serde::{Serialize, Deserialize, Serializer, Deserializer};
    use serde::de;
    /// Only expanded in the original crate with the feature "serde_support" enabled.
    impl Serialize for FixedStrNZ12 {
        fn serialize<S: Serializer>(&'_ self, serializer: S) -> Result<S::Ok, S::Error> {
            serializer.serialize_str(&self[..])
        }
    }
    struct FixedStrNZ12Visitor;
    impl<'de> de::Visitor<'de> for FixedStrNZ12Visitor {
        type Value = FixedStrNZ12;
        fn expecting<'a>(&'a self, formatter: &'a mut Formatter) -> FmtResult {
            formatter.write_str("a string containing exactly 12 bytes")
        }
        fn visit_str<E: de::Error>(self, s: &'_ str) -> Result<Self::Value, E> {
            if s.len() == 12 {
                Ok(FixedStrNZ12::from(s))
            } else {
                Err(de::Error::invalid_value(de::Unexpected::Str(s), &self))
            }
        }
    }
    /// Only expanded in the original crate with the feature "serde_support" enabled.
    impl<'de> Deserialize<'de> for FixedStrNZ12 {
        fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
            deserializer.deserialize_str(FixedStrNZ12Visitor)
        }
    }
    use core::str::pattern::{Pattern, Searcher, SearchStep};
    /// A transparent wrapper for a closure or function,used for implement Pattern on it,needed due to the orphan rule.
    ///
    /// This is only expanded with the feature `pattern_pred_support` enabled.   
    #[repr(transparent)]
    pub struct Closure<F: FnMut(FixedStrNZ12) -> bool> {
        pub f: F,
    }
    /// This is only expanded with the feature `pattern_pred_support` enabled.
    impl<F: FnMut(FixedStrNZ12) -> bool> From<F> for Closure<F> {
        fn from(f: F) -> Self {
            Self { f }
        }
    }
    /// This is only expanded with the feature `pattern_pred_support` enabled.
    impl<'a, F: FnMut(FixedStrNZ12) -> bool> Pattern<'a> for Closure<F> {
        type Searcher = FixedStrNZ12PredicateSearcher<'a, F>;
        fn into_searcher(self, haystack: &'a str) -> Self::Searcher {
            FixedStrNZ12PredicateSearcher {
                pattern: self,
                start: 0,
                end: 0,
                haystack,
            }
        }
    }
    /// A Searcher that takes as pattern a predicate which takes FixedStrNZ12.
    ///
    /// As FixedStrNZ12 not allows bytes with zeroes and those are not stripped in the
    /// [`Deref`](struct.FixedStrNZ12.html#impl-Deref) and [`PartialEq`](struct.FixedStrNZ12.html#impl-PartialEq) implementation
    /// therefore this searcher searchs upon subslices with length *12*,skipping some
    /// bytes when the haystack length is not a multiple of 12.
    ///
    /// This is only expanded with the feature `pattern_pred_support` enabled.   
    pub struct FixedStrNZ12PredicateSearcher<'a, F: FnMut(FixedStrNZ12) -> bool> {
        pattern: Closure<F>,
        haystack: &'a str,
        start: usize,
        end: usize,
    }
    /// This is only expanded with the feature `pattern_pred_support` enabled.   
    unsafe impl<'a, F: FnMut(FixedStrNZ12) -> bool> Searcher<'a>
        for FixedStrNZ12PredicateSearcher<'a, F>
    {
        #[inline]
        fn haystack(&self) -> &'a str {
            &self.haystack
        }
        #[inline]
        fn next(&mut self) -> SearchStep {
            if self.start == self.haystack().len() {
                return SearchStep::Done;
            }
            let pat = unsafe {
                let temp = &self.haystack[self.start..];
                if temp.len() >= 12 {
                    FixedStrNZ12::from_str_unchecked(temp.get_unchecked(..12))
                } else {
                    return SearchStep::Done;
                }
            };
            self.end += 12;
            let start_s = self.start;
            self.start = self.end;
            if unsafe { core::mem::transmute_copy::<Closure<F>, F>(&self.pattern) }(pat) {
                SearchStep::Match(start_s, self.end)
            } else {
                SearchStep::Reject(start_s, self.end)
            }
        }
    }
}
pub use fixed_str_nz12::FixedStrNZ12;
