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

Commit798f81b

Browse files
committed
smol_str 0.3 support
1 parentf52f821 commit798f81b

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

‎postgres-types/Cargo.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ with-jiff-0_1 = ["jiff-01"]
2525
with-serde_json-1 = ["serde-1","serde_json-1"]
2626
with-smol_str-01 = ["smol_str-01"]
2727
with-smol_str-02 = ["smol_str-02"]
28+
with-smol_str-03 = ["smol_str-03"]
2829
with-uuid-0_8 = ["uuid-08"]
2930
with-uuid-1 = ["uuid-1"]
3031
with-time-0_2 = ["time-02"]
@@ -57,3 +58,4 @@ time-02 = { version = "0.2", package = "time", optional = true }
5758
time-03 = {version ="0.3",package ="time",default-features =false,optional =true }
5859
smol_str-01 = {version ="0.1.23",package ="smol_str",default-features =false,optional =true }
5960
smol_str-02 = {version ="0.2",package ="smol_str",default-features =false,optional =true }
61+
smol_str-03 = {version ="0.3",package ="smol_str",default-features =false,optional =true }

‎postgres-types/src/lib.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ mod serde_json_1;
284284
mod smol_str_01;
285285
#[cfg(feature ="with-smol_str-02")]
286286
mod smol_str_02;
287+
#[cfg(feature ="with-smol_str-03")]
288+
mod smol_str_03;
287289
#[cfg(feature ="with-time-0_2")]
288290
mod time_02;
289291
#[cfg(feature ="with-time-0_3")]

‎postgres-types/src/smol_str_03.rs‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use bytes::BytesMut;
2+
use smol_str_03::SmolStr;
3+
use std::error::Error;
4+
5+
usecrate::{FromSql,IsNull,ToSql,Type};
6+
7+
impl<'a>FromSql<'a>forSmolStr{
8+
fnfrom_sql(ty:&Type,raw:&'a[u8]) ->Result<Self,Box<dynError +Sync +Send>>{
9+
<&strasFromSql>::from_sql(ty, raw).map(SmolStr::new)
10+
}
11+
12+
fnaccepts(ty:&Type) ->bool{
13+
<&strasFromSql>::accepts(ty)
14+
}
15+
}
16+
17+
implToSqlforSmolStr{
18+
fnto_sql(
19+
&self,
20+
ty:&Type,
21+
out:&mutBytesMut,
22+
) ->Result<IsNull,Box<dynError +Sync +Send>>{
23+
<&strasToSql>::to_sql(&self.as_str(), ty, out)
24+
}
25+
26+
fnaccepts(ty:&Type) ->bool{
27+
<&strasToSql>::accepts(ty)
28+
}
29+
30+
to_sql_checked!();
31+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp