Enum prim_int_kind::PrimIntKind
source · [−]pub enum PrimIntKind {
U8,
U16,
U32,
U64,
U128,
Usize,
I8,
I16,
I32,
I64,
I128,
Isize,
}
Expand description
Enumerates primitive integer kinds as per Rust’s reference
Examples
Stable Rust
use prim_int_kind::PrimIntKind;
let res_kind = "u16".parse();
assert_eq!(res_kind, Ok(PrimIntKind::U16));
With const_trait_impl
nightly feature
Cargo.toml
[features]
const_trait_impl = ["prim_int_kind/const_trait_impl"]
src/main.rs
#![cfg_attr(any(doc,test,doctest, feature = "const_trait_impl"), feature(const_trait_impl))]
// Run via `cargo run --features const_trait_impl`
use core::str::FromStr;
use prim_int_kind::{PrimIntKind, PrimIntKindParsingError};
#[cfg(any(doc,test,doctest, feature = "const_trait_impl"))]
const res_kind: Result<PrimIntKind, PrimIntKindParsingError> = PrimIntKind::from_str("u16");
#[cfg(not(any(doc,test,doctest, feature = "const_trait_impl")))]
let res_kind: Result<PrimIntKind, PrimIntKindParsingError> = PrimIntKind::from_str("u16");
assert_eq!(res_kind, Ok(PrimIntKind::U16));
Variants
U8
U16
U32
U64
U128
Usize
I8
I16
I32
I64
I128
Isize
Trait Implementations
sourceimpl Debug for PrimIntKind
impl Debug for PrimIntKind
sourceimpl FromStr for PrimIntKind
impl FromStr for PrimIntKind
type Err = PrimIntKindParsingError
type Err = PrimIntKindParsingError
The associated error which can be returned from parsing.
sourceimpl PartialEq<PrimIntKind> for PrimIntKind
impl PartialEq<PrimIntKind> for PrimIntKind
impl Eq for PrimIntKind
impl StructuralEq for PrimIntKind
impl StructuralPartialEq for PrimIntKind
Auto Trait Implementations
impl RefUnwindSafe for PrimIntKind
impl Send for PrimIntKind
impl Sync for PrimIntKind
impl Unpin for PrimIntKind
impl UnwindSafe for PrimIntKind
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more