Struct diesel::pg::types::sql_types::Cidr
[−]
[src]
pub struct Cidr;
The CIDR
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 -> Cidr, } } 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 Cidr
[src]
impl NotNull for Cidr
[src]
impl SingleValue for Cidr
[src]
impl Debug for Cidr
[src]
impl Clone for Cidr
[src]
fn clone(&self) -> Cidr
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more