Struct diesel::pg::types::sql_types::MacAddr [] [src]

pub struct MacAddr;

The MACADDR SQL type. This type can only be used with feature = "network-address"

ToSql impls

  • [u8; 6]

FromSql impls

  • [u8; 6]

Examples


#[derive(Queryable)]
struct Device {
    id: i32,
    macaddr: [u8; 6],
}

#[derive(Insertable)]
#[table_name="devices"]
struct NewDevice {
    macaddr: [u8;6],
}

table! {
    devices {
        id -> Integer,
        macaddr -> MacAddr,
    }
}

let new_device = NewDevice {
    macaddr: [0x08, 0x00, 0x2b, 0x01, 0x02, 0x03],
};
let inserted_device = insert(&new_device).into(devices)
    .get_result::<Device>(&connection).unwrap();
assert_eq!([0x08, 0x00, 0x2b, 0x01, 0x02, 0x03], inserted_device.macaddr);

Trait Implementations

impl QueryId for MacAddr
[src]

impl NotNull for MacAddr
[src]

impl SingleValue for MacAddr
[src]

impl Debug for MacAddr
[src]

Formats the value using the given formatter.

impl Clone for MacAddr
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for MacAddr
[src]

impl Default for MacAddr
[src]

Returns the "default value" for a type. Read more