Trait PrintfArgument

Source
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 impls in order to unconditionally preserve safety.

Provided Associated Constants§

Source

const IS_CHAR: bool = false

Whether the type is consistent with C’s char.

Source

const IS_SHORT: bool = false

Whether the type is consistent with C’s short int.

Source

const IS_INT: bool = false

Whether the type is consistent with C’s int.

Source

const IS_LONG: bool = false

Whether the type is consistent with C’s long int.

Source

const IS_LONG_LONG: bool = false

Whether the type is consistent with C’s long long int.

Source

const IS_SIZE: bool = false

Available on crate feature libc only.

Whether the type is consistent with C’s size_t.

Source

const IS_MAX: bool = false

Available on crate feature libc only.

Whether the type is consistent with C’s intmax_t.

Source

const IS_PTRDIFF: bool = false

Available on crate feature libc only.

Whether the type is consistent with C’s ptrdiff_t.

Source

const IS_SIGNED: bool = false

Whether the type is a signed integer type, as opposed to unsigned.

Source

const IS_FLOAT: bool = false

Whether the type is floating-point.

Source

const IS_C_STRING: bool = false

Whether the type is a null-terminated string.

Source

const IS_POINTER: bool = false

Whether the type is a pointer.

Required Associated Types§

Source

type CPrintfType

The C type corresponding to Self that we should really send as an argument to a printf(3)-like function.

Required Methods§

Source

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

Source§

impl PrintfArgument for f64

Source§

impl PrintfArgument for i8

Source§

const IS_SIGNED: bool = true

Source§

const IS_CHAR: bool = true

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = false

Source§

const IS_LONG_LONG: bool = false

Source§

const IS_SIZE: bool = false

Available on crate feature libc only.
Source§

const IS_MAX: bool = false

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = false

Available on crate feature libc only.
Source§

type CPrintfType = <i8 as LargerOfOp<i32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for i16

Source§

const IS_SIGNED: bool = true

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = true

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = false

Source§

const IS_LONG_LONG: bool = false

Source§

const IS_SIZE: bool = false

Available on crate feature libc only.
Source§

const IS_MAX: bool = false

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = false

Available on crate feature libc only.
Source§

type CPrintfType = <i16 as LargerOfOp<i32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for i32

Source§

const IS_SIGNED: bool = true

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = true

Source§

const IS_LONG: bool = false

Source§

const IS_LONG_LONG: bool = false

Source§

const IS_SIZE: bool = false

Available on crate feature libc only.
Source§

const IS_MAX: bool = false

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = false

Available on crate feature libc only.
Source§

type CPrintfType = <i32 as LargerOfOp<i32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for i64

Source§

const IS_SIGNED: bool = true

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = true

Source§

const IS_LONG_LONG: bool = true

Source§

const IS_SIZE: bool = true

Available on crate feature libc only.
Source§

const IS_MAX: bool = true

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = true

Available on crate feature libc only.
Source§

type CPrintfType = <i64 as LargerOfOp<i32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for isize

Source§

const IS_SIGNED: bool = true

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = true

Source§

const IS_LONG_LONG: bool = true

Source§

const IS_SIZE: bool = true

Available on crate feature libc only.
Source§

const IS_MAX: bool = true

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = true

Available on crate feature libc only.
Source§

type CPrintfType = <isize as LargerOfOp<i32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for u8

Source§

const IS_SIGNED: bool = false

Source§

const IS_CHAR: bool = true

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = false

Source§

const IS_LONG_LONG: bool = false

Source§

const IS_SIZE: bool = false

Available on crate feature libc only.
Source§

const IS_MAX: bool = false

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = false

Available on crate feature libc only.
Source§

type CPrintfType = <u8 as LargerOfOp<u32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for u16

Source§

const IS_SIGNED: bool = false

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = true

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = false

Source§

const IS_LONG_LONG: bool = false

Source§

const IS_SIZE: bool = false

Available on crate feature libc only.
Source§

const IS_MAX: bool = false

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = false

Available on crate feature libc only.
Source§

type CPrintfType = <u16 as LargerOfOp<u32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for u32

Source§

const IS_SIGNED: bool = false

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = true

Source§

const IS_LONG: bool = false

Source§

const IS_LONG_LONG: bool = false

Source§

const IS_SIZE: bool = false

Available on crate feature libc only.
Source§

const IS_MAX: bool = false

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = false

Available on crate feature libc only.
Source§

type CPrintfType = <u32 as LargerOfOp<u32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for u64

Source§

const IS_SIGNED: bool = false

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = true

Source§

const IS_LONG_LONG: bool = true

Source§

const IS_SIZE: bool = true

Available on crate feature libc only.
Source§

const IS_MAX: bool = true

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = true

Available on crate feature libc only.
Source§

type CPrintfType = <u64 as LargerOfOp<u32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl PrintfArgument for usize

Source§

const IS_SIGNED: bool = false

Source§

const IS_CHAR: bool = false

Source§

const IS_SHORT: bool = false

Source§

const IS_INT: bool = false

Source§

const IS_LONG: bool = true

Source§

const IS_LONG_LONG: bool = true

Source§

const IS_SIZE: bool = true

Available on crate feature libc only.
Source§

const IS_MAX: bool = true

Available on crate feature libc only.
Source§

const IS_PTRDIFF: bool = true

Available on crate feature libc only.
Source§

type CPrintfType = <usize as LargerOfOp<u32>>::Output

Source§

fn as_c_val(self) -> Self::CPrintfType

Source§

impl<T: AsRef<CStr> + ?Sized> PrintfArgument for &T

Source§

impl<T: Sized> PrintfArgument for *const T

Source§

impl<T: Sized> PrintfArgument for *mut T

Implementors§