pub trait PrintfArgument: PrintfArgumentPrivate + Copy {
type CPrintfType;
Show 12 associated constants and 1 method
const IS_CHAR: bool = false;
const IS_SHORT: bool = false;
const IS_INT: bool = false;
const IS_LONG: bool = false;
const IS_LONG_LONG: bool = false;
const IS_SIZE: bool = false;
const IS_MAX: bool = false;
const IS_PTRDIFF: bool = false;
const IS_SIGNED: bool = false;
const IS_FLOAT: bool = false;
const IS_C_STRING: bool = false;
const IS_POINTER: bool = false;
// Required method
fn as_c_val(self) -> Self::CPrintfType;
}
Expand description
A Rust-side argument to a safe wrapper around a printf(3)
-like function.
This is a sealed trait; consumers of this crate are not allowed
to create their own impl
s in order to unconditionally preserve
safety.
Provided Associated Constants§
Sourceconst IS_LONG_LONG: bool = false
const IS_LONG_LONG: bool = false
Whether the type is consistent with C’s long long int
.
Sourceconst IS_SIZE: bool = false
Available on crate feature libc
only.
const IS_SIZE: bool = false
libc
only.Whether the type is consistent with C’s size_t
.
Sourceconst IS_MAX: bool = false
Available on crate feature libc
only.
const IS_MAX: bool = false
libc
only.Whether the type is consistent with C’s intmax_t
.
Sourceconst IS_PTRDIFF: bool = false
Available on crate feature libc
only.
const IS_PTRDIFF: bool = false
libc
only.Whether the type is consistent with C’s ptrdiff_t
.
Sourceconst IS_SIGNED: bool = false
const IS_SIGNED: bool = false
Whether the type is a signed integer type, as opposed to unsigned.
Sourceconst IS_C_STRING: bool = false
const IS_C_STRING: bool = false
Whether the type is a null-terminated string.
Sourceconst IS_POINTER: bool = false
const IS_POINTER: bool = false
Whether the type is a pointer.
Required Associated Types§
Sourcetype CPrintfType
type CPrintfType
The C type corresponding to Self
that we should really send
as an argument to a printf(3)
-like function.
Required Methods§
Sourcefn as_c_val(self) -> Self::CPrintfType
fn as_c_val(self) -> Self::CPrintfType
Converts self
to a value suitable for sending to printf(3)
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl PrintfArgument for f32
impl PrintfArgument for f32
Source§impl PrintfArgument for f64
impl PrintfArgument for f64
Source§impl PrintfArgument for i8
impl PrintfArgument for i8
const IS_SIGNED: bool = true
const IS_CHAR: bool = true
const IS_SHORT: bool = false
const IS_INT: bool = false
const IS_LONG: bool = false
const IS_LONG_LONG: bool = false
Source§const IS_PTRDIFF: bool = false
const IS_PTRDIFF: bool = false
libc
only.type CPrintfType = <i8 as LargerOfOp<i32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for i16
impl PrintfArgument for i16
const IS_SIGNED: bool = true
const IS_CHAR: bool = false
const IS_SHORT: bool = true
const IS_INT: bool = false
const IS_LONG: bool = false
const IS_LONG_LONG: bool = false
Source§const IS_PTRDIFF: bool = false
const IS_PTRDIFF: bool = false
libc
only.type CPrintfType = <i16 as LargerOfOp<i32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for i32
impl PrintfArgument for i32
const IS_SIGNED: bool = true
const IS_CHAR: bool = false
const IS_SHORT: bool = false
const IS_INT: bool = true
const IS_LONG: bool = false
const IS_LONG_LONG: bool = false
Source§const IS_PTRDIFF: bool = false
const IS_PTRDIFF: bool = false
libc
only.type CPrintfType = <i32 as LargerOfOp<i32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for i64
impl PrintfArgument for i64
const IS_SIGNED: bool = true
const IS_CHAR: bool = false
const IS_SHORT: bool = false
const IS_INT: bool = false
const IS_LONG: bool = true
const IS_LONG_LONG: bool = true
Source§const IS_PTRDIFF: bool = true
const IS_PTRDIFF: bool = true
libc
only.type CPrintfType = <i64 as LargerOfOp<i32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for isize
impl PrintfArgument for isize
const IS_SIGNED: bool = true
const IS_CHAR: bool = false
const IS_SHORT: bool = false
const IS_INT: bool = false
const IS_LONG: bool = true
const IS_LONG_LONG: bool = true
Source§const IS_PTRDIFF: bool = true
const IS_PTRDIFF: bool = true
libc
only.type CPrintfType = <isize as LargerOfOp<i32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for u8
impl PrintfArgument for u8
const IS_SIGNED: bool = false
const IS_CHAR: bool = true
const IS_SHORT: bool = false
const IS_INT: bool = false
const IS_LONG: bool = false
const IS_LONG_LONG: bool = false
Source§const IS_PTRDIFF: bool = false
const IS_PTRDIFF: bool = false
libc
only.type CPrintfType = <u8 as LargerOfOp<u32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for u16
impl PrintfArgument for u16
const IS_SIGNED: bool = false
const IS_CHAR: bool = false
const IS_SHORT: bool = true
const IS_INT: bool = false
const IS_LONG: bool = false
const IS_LONG_LONG: bool = false
Source§const IS_PTRDIFF: bool = false
const IS_PTRDIFF: bool = false
libc
only.type CPrintfType = <u16 as LargerOfOp<u32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for u32
impl PrintfArgument for u32
const IS_SIGNED: bool = false
const IS_CHAR: bool = false
const IS_SHORT: bool = false
const IS_INT: bool = true
const IS_LONG: bool = false
const IS_LONG_LONG: bool = false
Source§const IS_PTRDIFF: bool = false
const IS_PTRDIFF: bool = false
libc
only.type CPrintfType = <u32 as LargerOfOp<u32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for u64
impl PrintfArgument for u64
const IS_SIGNED: bool = false
const IS_CHAR: bool = false
const IS_SHORT: bool = false
const IS_INT: bool = false
const IS_LONG: bool = true
const IS_LONG_LONG: bool = true
Source§const IS_PTRDIFF: bool = true
const IS_PTRDIFF: bool = true
libc
only.type CPrintfType = <u64 as LargerOfOp<u32>>::Output
fn as_c_val(self) -> Self::CPrintfType
Source§impl PrintfArgument for usize
impl PrintfArgument for usize
const IS_SIGNED: bool = false
const IS_CHAR: bool = false
const IS_SHORT: bool = false
const IS_INT: bool = false
const IS_LONG: bool = true
const IS_LONG_LONG: bool = true
Source§const IS_PTRDIFF: bool = true
const IS_PTRDIFF: bool = true
libc
only.