Improve ser function naming
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -4,7 +4,7 @@ use time::OffsetDateTime;
|
|||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct News {
|
pub struct News {
|
||||||
#[serde(serialize_with = "ser::remove_slash_from_pairs_join_symbols")]
|
#[serde(serialize_with = "ser::remove_slash_and_join_symbols")]
|
||||||
pub symbols: Vec<String>,
|
pub symbols: Vec<String>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(with = "time::serde::rfc3339::option")]
|
#[serde(with = "time::serde::rfc3339::option")]
|
||||||
|
@@ -58,12 +58,12 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_slash_from_symbols<'a, S, I>(pairs: I, serializer: S) -> Result<S::Ok, S::Error>
|
pub fn remove_slash_from_symbols<'a, S, I>(symbols: I, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
I: IntoIterator<Item = &'a String>,
|
I: IntoIterator<Item = &'a String>,
|
||||||
{
|
{
|
||||||
let symbols = pairs
|
let symbols = symbols
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|pair| remove_slash(pair))
|
.map(|pair| remove_slash(pair))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
@@ -75,15 +75,13 @@ where
|
|||||||
seq.end()
|
seq.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_slash_from_pairs_join_symbols<S>(
|
pub fn remove_slash_and_join_symbols<'a, S, I>(symbols: I, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
symbols: &[String],
|
|
||||||
serializer: S,
|
|
||||||
) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
where
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
|
I: IntoIterator<Item = &'a String>,
|
||||||
{
|
{
|
||||||
let symbols = symbols
|
let symbols = symbols
|
||||||
.iter()
|
.into_iter()
|
||||||
.map(|symbol| remove_slash(symbol))
|
.map(|symbol| remove_slash(symbol))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user