Struct safer_ffi::c_int

source ·
#[repr(transparent)]
pub struct c_int(pub c_int);
Expand description

A ReprC standalone type with the same layout and ABI as ::libc::c_int.

By standalone, the idea is that this is defined as a (transparent) newtype struct, rather than as a type alias, which is error-prone and yields less-portable headers (since the header generation will resolve the type alias and emit, for instance, int32_t, ⚠️).

By using this type, you guarantee that the C int type be used in the headers.

Tuple Fields§

§0: c_int

Trait Implementations§

source§

impl Clone for c_int

source§

fn clone(&self) -> c_int

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for c_int

source§

fn fmt(self: &c_int, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl LegacyCType for c_int

source§

fn c_short_name_fmt(fmt: &mut Formatter<'_>) -> Result

A short-name description of the type, mainly used to fill “placeholders” such as when monomorphising generics structs or arrays. Read more
source§

fn c_var_fmt(fmt: &mut Formatter<'_>, var_name: &str) -> Result

The core method of the trait: it provides the implementation to be used by [CType::c_var], by bringing a Formatter in scope. Read more
source§

fn c_define_self(_: &mut dyn Definer) -> Result<()>

Necessary one-time code for [CType::c_var]() to make sense. Read more
source§

fn csharp_define_self(_: &mut dyn Definer) -> Result<()>

Extra typedef code (e.g. [LayoutKind.Sequential] struct ...)
source§

fn csharp_ty() -> String

Type name (e.g., int, string, IntPtr)
source§

fn legacy_csharp_marshaler() -> Option<String>

Optional marshaler attached to the type (e.g., [MarshalAs(UnmanagedType.FunctionPtr)])
§

type OPAQUE_KIND = Concrete

source§

fn c_short_name() -> ImplDisplay<Self>

Convenience function for callers / users of types implementing CType. Read more
source§

fn c_var(var_name: &str) -> ImplDisplay<'_, Self>

Convenience function for callers / users of types implementing CType. Read more
source§

fn csharp_var(var_name: &str) -> String

Convenience function for formatting {ty} {var} in CSharp.
source§

impl PartialEq for c_int

source§

fn eq(&self, other: &c_int) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for c_int

source§

impl Eq for c_int

source§

impl StructuralPartialEq for c_int

Auto Trait Implementations§

§

impl Freeze for c_int

§

impl RefUnwindSafe for c_int

§

impl Send for c_int

§

impl Sync for c_int

§

impl Unpin for c_int

§

impl UnwindSafe for c_int

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsOut<T> for T
where T: Copy,

source§

fn as_out<'out>(&'out mut self) -> Out<'out, T>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CType for T
where T: LegacyCType,

§

type OPAQUE_KIND = <T as LegacyCType>::OPAQUE_KIND

source§

fn short_name() -> String

source§

fn define_self__impl( _: &(dyn HeaderLanguage + 'static), _: &mut dyn Definer ) -> Result<(), Error>

source§

fn define_self( language: &(dyn HeaderLanguage + 'static), definer: &mut dyn Definer ) -> Result<(), Error>

source§

fn name(language: &(dyn HeaderLanguage + 'static)) -> String

source§

fn name_wrapping_var( language: &(dyn HeaderLanguage + 'static), var_name: &str ) -> String

source§

fn csharp_marshaler() -> Option<String>

Optional marshaler attached to the type (e.g., [MarshalAs(UnmanagedType.FunctionPtr)])
source§

fn zeroed() -> Self

source§

impl<T> CompatExt for T

source§

fn compat(self) -> Compat<T>

Applies the Compat adapter by value. Read more
source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
source§

impl<T> FitForCBox for T

§

type CBoxWrapped = Box_<T>

Available on crate feature alloc only.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ManuallyDropMut for T

§

type Ret = ManuallyDrop<T>

source§

fn manually_drop_mut<'__>(&'__ mut self) -> &'__ mut ManuallyDrop<T>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UpcastAny for T
where T: 'static,

source§

fn upcast_any(&self) -> &(dyn Any + 'static)

Available on crate feature headers only.