[][src]Struct ffi_convert::CRange

#[repr(C)]pub struct CRange<T> {
    pub start: T,
    pub end: T,
}

A utility type to represent range. Note that the parametrized type T should have have CReprOf and AsRust trait implementated.

Example

use ffi_convert::{CReprOf, AsRust, CDrop, CRange};
use std::ops::Range;

#[derive(Clone, Debug, PartialEq)]
pub struct Foo {
    pub range: Range<i32>
}

#[derive(AsRust, CDrop, CReprOf, Debug, PartialEq)]
#[target_type(Foo)]
pub struct CFoo {
    pub range: CRange<i32>
}

let foo = Foo {
    range: Range {
        start: 20,
        end: 30,
    }
};

let c_foo = CFoo {
    range: CRange {
        start: 20,
        end: 30,
    }
};

let c_foo_converted = CFoo::c_repr_of(foo.clone()).unwrap();
assert_eq!(c_foo, c_foo_converted);

let foo_converted = c_foo.as_rust().unwrap();
assert_eq!(foo_converted, foo);

Fields

start: Tend: T

Trait Implementations

impl<U: AsRust<V>, V: PartialOrd + PartialEq> AsRust<Range<V>> for CRange<U>[src]

impl<T> CDrop for CRange<T>[src]

impl<U: CReprOf<V> + CDrop, V: PartialOrd + PartialEq> CReprOf<Range<V>> for CRange<U>[src]

impl<T: Clone> Clone for CRange<T>[src]

impl<T: Debug> Debug for CRange<T>[src]

impl<T> Drop for CRange<T>[src]

impl<T: PartialEq> PartialEq<CRange<T>> for CRange<T>[src]

impl<T> StructuralPartialEq for CRange<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for CRange<T> where
    T: RefUnwindSafe

impl<T> Send for CRange<T> where
    T: Send

impl<T> Sync for CRange<T> where
    T: Sync

impl<T> Unpin for CRange<T> where
    T: Unpin

impl<T> UnwindSafe for CRange<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.