Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd7bc07

Browse files
committed
Document cidr type conversion and run rustfmt
1 parent9685f9c commitdd7bc07

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

‎postgres-types/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ postgres-derive = { version = "0.4.0", optional = true, path = "../postgres-deri
3333

3434
array-init = {version ="2",optional =true }
3535
bit-vec-06 = {version ="0.6",package ="bit-vec",optional =true }
36-
cidr-02 = {version ="0.2",package ="cidr",optional =true }
3736
chrono-04 = {version ="0.4.16",package ="chrono",default-features =false,features = ["clock"],optional =true }
37+
cidr-02 = {version ="0.2",package ="cidr",optional =true }
3838
eui48-04 = {version ="0.4",package ="eui48",optional =true }
3939
eui48-1 = {version ="1.0",package ="eui48",optional =true }
4040
geo-types-06 = {version ="0.6",package ="geo-types",optional =true }

‎postgres-types/src/cidr_02.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ use crate::{FromSql, IsNull, ToSql, Type};
88
impl<'a>FromSql<'a>forIpCidr{
99
fnfrom_sql(_:&Type,raw:&[u8]) ->Result<Self,Box<dynError +Sync +Send>>{
1010
let inet = types::inet_from_sql(raw)?;
11-
Ok(IpCidr::new(inet.addr(), inet.netmask()).expect("postgres cidr type has zeroed host portion"))
11+
Ok(IpCidr::new(inet.addr(), inet.netmask())
12+
.expect("postgres cidr type has zeroed host portion"))
1213
}
1314

1415
accepts!(CIDR);
@@ -27,7 +28,8 @@ impl ToSql for IpCidr {
2728
impl<'a>FromSql<'a>forIpInet{
2829
fnfrom_sql(_:&Type,raw:&[u8]) ->Result<Self,Box<dynError +Sync +Send>>{
2930
let inet = types::inet_from_sql(raw)?;
30-
Ok(IpInet::new(inet.addr(), inet.netmask()).expect("postgres enforces maximum length of netmask"))
31+
Ok(IpInet::new(inet.addr(), inet.netmask())
32+
.expect("postgres enforces maximum length of netmask"))
3133
}
3234

3335
accepts!(INET);

‎postgres-types/src/lib.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ where
210210

211211
#[cfg(feature ="with-bit-vec-0_6")]
212212
mod bit_vec_06;
213-
#[cfg(feature ="with-cidr-0_2")]
214-
mod cidr_02;
215213
#[cfg(feature ="with-chrono-0_4")]
216214
mod chrono_04;
215+
#[cfg(feature ="with-cidr-0_2")]
216+
mod cidr_02;
217217
#[cfg(feature ="with-eui48-0_4")]
218218
mod eui48_04;
219219
#[cfg(feature ="with-eui48-1")]
@@ -438,6 +438,8 @@ impl WrongType {
438438
/// | `uuid::Uuid` | UUID |
439439
/// | `bit_vec::BitVec` | BIT, VARBIT |
440440
/// | `eui48::MacAddress` | MACADDR |
441+
/// | `cidr::InetCidr` | CIDR |
442+
/// | `cidr::InetAddr` | INET |
441443
///
442444
/// # Nullability
443445
///

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp