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

pub struct Inet;

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

ToSql impls

FromSql impls

Examples

extern crate ipnetwork;
use ipnetwork::IpNetwork;

#[derive(Queryable)]
struct Client {
    id: i32,
    ip_address: IpNetwork,
}

#[derive(Insertable)]
#[table_name="clients"]
struct NewClient {
    ip_address: IpNetwork,
}

table! {
    clients {
        id -> Integer,
        ip_address -> Inet,
    }
}

let new_client = NewClient {
    ip_address: "10.1.9.32/32".parse().unwrap(),
};
let inserted_client = insert(&new_client).into(clients)
    .get_result::<Client>(&connection).unwrap();
assert_eq!(IpNetwork::from_str("10.1.9.32/32").unwrap(), inserted_client.ip_address);

Trait Implementations

impl QueryId for Inet
[src]

impl NotNull for Inet
[src]

impl Debug for Inet
[src]

Formats the value using the given formatter.

impl Clone for Inet
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Inet
[src]

impl Default for Inet
[src]

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