pub struct Cidr;
Expand description
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;
table! {
clients {
id -> Integer,
ip_address -> Cidr,
}
}
let addr = IpNetwork::from_str("10.1.9.32/32").unwrap();
let inserted_addr = insert_into(clients)
.values(ip_address.eq(&addr))
.returning(ip_address)
.get_result(&connection);
assert_eq!(Ok(addr), inserted_addr);
Trait Implementations§
Source§impl<'expr2, 'expr> AsExpression<Cidr> for &'expr2 &'expr IpNetwork
impl<'expr2, 'expr> AsExpression<Cidr> for &'expr2 &'expr IpNetwork
Source§type Expression = Bound<Cidr, &'expr2 &'expr IpNetwork>
type Expression = Bound<Cidr, &'expr2 &'expr IpNetwork>
The expression being returned
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
Source§impl<'expr> AsExpression<Cidr> for &'expr IpNetwork
impl<'expr> AsExpression<Cidr> for &'expr IpNetwork
Source§type Expression = Bound<Cidr, &'expr IpNetwork>
type Expression = Bound<Cidr, &'expr IpNetwork>
The expression being returned
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
Source§impl AsExpression<Cidr> for IpNetwork
impl AsExpression<Cidr> for IpNetwork
Source§type Expression = Bound<Cidr, IpNetwork>
type Expression = Bound<Cidr, IpNetwork>
The expression being returned
Source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
Source§impl HasSqlType<Cidr> for Pg
impl HasSqlType<Cidr> for Pg
Source§fn metadata(_: &PgMetadataLookup) -> PgTypeMetadata
fn metadata(_: &PgMetadataLookup) -> PgTypeMetadata
Fetch the metadata for the given type Read more
Source§impl QueryId for Cidr
impl QueryId for Cidr
Source§const HAS_STATIC_QUERY_ID: bool = true
const HAS_STATIC_QUERY_ID: bool = true
Can the SQL generated by
Self
be uniquely identified by its type? Read moreimpl Copy for Cidr
impl NotNull for Cidr
impl SingleValue for Cidr
Auto Trait Implementations§
impl Freeze for Cidr
impl RefUnwindSafe for Cidr
impl Send for Cidr
impl Sync for Cidr
impl Unpin for Cidr
impl UnwindSafe for Cidr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more