Cargo-fmt pass
This commit is contained in:
+4
-2
@@ -3,8 +3,10 @@ use std::borrow::Cow;
|
||||
use serde::Serialize;
|
||||
use try_from::TryInto;
|
||||
|
||||
use crate::errors::{Error, Result};
|
||||
use crate::scopes::Scopes;
|
||||
use crate::{
|
||||
errors::{Error, Result},
|
||||
scopes::Scopes,
|
||||
};
|
||||
|
||||
/// Represents an application that can be registered with a mastodon instance
|
||||
#[derive(Clone, Debug, Default, Serialize, PartialEq)]
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
/// Raw data about mastodon app. Save `Data` using `serde` to prevent needing
|
||||
/// to authenticate on every run.
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
//! A module containing everything relating to a account returned from the api.
|
||||
|
||||
use chrono::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::de::{self, Unexpected};
|
||||
use crate::status_builder;
|
||||
use chrono::prelude::*;
|
||||
use serde::{
|
||||
de::{self, Unexpected},
|
||||
Deserialize,
|
||||
Serialize,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// A struct representing an Account.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Represents a single Filter
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Module containing everything related to an instance.
|
||||
use serde::Deserialize;
|
||||
use super::account::Account;
|
||||
use serde::Deserialize;
|
||||
|
||||
/// A struct containing info of an instance.
|
||||
#[derive(Debug, Clone, Deserialize, PartialEq)]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::http_send::HttpSend;
|
||||
use crate::page::Page;
|
||||
use crate::{http_send::HttpSend, page::Page};
|
||||
use serde::Deserialize;
|
||||
|
||||
/// Abstracts away the `next_page` logic into a single stream of items
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Module containing all info about notifications.
|
||||
|
||||
use serde::Deserialize;
|
||||
use super::{account::Account, status::Status};
|
||||
use chrono::prelude::*;
|
||||
use serde::Deserialize;
|
||||
|
||||
/// A struct containing info about a notification.
|
||||
#[derive(Debug, Clone, Deserialize, PartialEq)]
|
||||
|
||||
@@ -27,8 +27,8 @@ pub struct Subscription {
|
||||
}
|
||||
|
||||
pub(crate) mod add_subscription {
|
||||
use serde::Serialize;
|
||||
use super::Alerts;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
|
||||
pub(crate) struct Form {
|
||||
@@ -55,8 +55,8 @@ pub(crate) mod add_subscription {
|
||||
}
|
||||
|
||||
pub(crate) mod update_data {
|
||||
use serde::Serialize;
|
||||
use super::Alerts;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
|
||||
pub(crate) struct Data {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
//! Module containing all info relating to a status.
|
||||
|
||||
use super::prelude::*;
|
||||
use crate::{entities::card::Card, status_builder::Visibility};
|
||||
use chrono::prelude::*;
|
||||
use crate::entities::card::Card;
|
||||
use crate::status_builder::Visibility;
|
||||
use serde::Deserialize;
|
||||
|
||||
/// A status from the instance.
|
||||
|
||||
+7
-9
@@ -1,6 +1,10 @@
|
||||
use std::{error, fmt, io::Error as IoError};
|
||||
use serde::Deserialize;
|
||||
use std::{error, fmt, io::Error as IoError};
|
||||
|
||||
#[cfg(feature = "toml")]
|
||||
use ::toml::de::Error as TomlDeError;
|
||||
#[cfg(feature = "toml")]
|
||||
use ::toml::ser::Error as TomlSerError;
|
||||
#[cfg(feature = "env")]
|
||||
use envy::Error as EnvyError;
|
||||
use hyper_old_types::Error as HeaderParseError;
|
||||
@@ -8,12 +12,8 @@ use reqwest::{header::ToStrError as HeaderStrError, Error as HttpError, StatusCo
|
||||
use serde_json::Error as SerdeError;
|
||||
use serde_qs::Error as SerdeQsError;
|
||||
use serde_urlencoded::ser::Error as UrlEncodedError;
|
||||
#[cfg(feature = "toml")]
|
||||
use ::toml::de::Error as TomlDeError;
|
||||
#[cfg(feature = "toml")]
|
||||
use ::toml::ser::Error as TomlSerError;
|
||||
use url::ParseError as UrlError;
|
||||
use tungstenite::error::Error as WebSocketError;
|
||||
use url::ParseError as UrlError;
|
||||
|
||||
/// Convience type over `std::result::Result` with `Error` as the error type.
|
||||
pub type Result<T> = ::std::result::Result<T, Error>;
|
||||
@@ -94,9 +94,7 @@ impl error::Error for Error {
|
||||
Error::SerdeQs(ref e) => e,
|
||||
Error::WebSocket(ref e) => e,
|
||||
|
||||
Error::Client(..) | Error::Server(..) => {
|
||||
return None
|
||||
},
|
||||
Error::Client(..) | Error::Server(..) => return None,
|
||||
Error::ClientIdRequired => return None,
|
||||
Error::ClientSecretRequired => return None,
|
||||
Error::AccessTokenRequired => return None,
|
||||
|
||||
+1
-4
@@ -1,9 +1,6 @@
|
||||
use std::io::{self, BufRead, Write};
|
||||
|
||||
use crate::errors::Result;
|
||||
use crate::http_send::HttpSend;
|
||||
use crate::registration::Registered;
|
||||
use crate::Mastodon;
|
||||
use crate::{errors::Result, http_send::HttpSend, registration::Registered, Mastodon};
|
||||
|
||||
/// Finishes the authentication process for the given `Registered` object,
|
||||
/// using the command-line
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
use envy;
|
||||
|
||||
use crate::data::Data;
|
||||
use crate::Result;
|
||||
use crate::{data::Data, Result};
|
||||
|
||||
/// Attempts to deserialize a Data struct from the environment
|
||||
pub fn from_env() -> Result<Data> {
|
||||
|
||||
+1
-2
@@ -6,8 +6,7 @@ use std::{
|
||||
|
||||
use serde_json;
|
||||
|
||||
use crate::data::Data;
|
||||
use crate::Result;
|
||||
use crate::{data::Data, Result};
|
||||
|
||||
/// Attempts to deserialize a Data struct from a string
|
||||
pub fn from_str(s: &str) -> Result<Data> {
|
||||
|
||||
+1
-2
@@ -4,8 +4,7 @@ use std::{
|
||||
path::Path,
|
||||
};
|
||||
|
||||
use crate::data::Data;
|
||||
use crate::Result;
|
||||
use crate::{data::Data, Result};
|
||||
|
||||
/// Attempts to deserialize a Data struct from a string
|
||||
pub fn from_str(s: &str) -> Result<Data> {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
use crate::Result;
|
||||
use reqwest::{Client, Request, RequestBuilder, Response};
|
||||
use std::fmt::Debug;
|
||||
use crate::Result;
|
||||
|
||||
/// Abstracts away the process of turning an HTTP request into an HTTP response
|
||||
pub trait HttpSend: Clone + Debug {
|
||||
|
||||
+55
-44
@@ -71,34 +71,34 @@
|
||||
)]
|
||||
#![allow(broken_intra_doc_links)]
|
||||
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
io::BufRead,
|
||||
ops,
|
||||
};
|
||||
use std::{borrow::Cow, io::BufRead, ops};
|
||||
|
||||
use reqwest::{Client, RequestBuilder, Response};
|
||||
use tap_reader::Tap;
|
||||
use tungstenite::client::AutoStream;
|
||||
|
||||
use crate::entities::prelude::*;
|
||||
use crate::http_send::{HttpSend, HttpSender};
|
||||
use crate::page::Page;
|
||||
|
||||
pub use crate::data::Data;
|
||||
pub use crate::errors::{ApiError, Error, Result};
|
||||
pub use isolang::Language;
|
||||
pub use crate::mastodon_client::{MastodonClient, MastodonUnauthenticated};
|
||||
pub use crate::media_builder::MediaBuilder;
|
||||
pub use crate::registration::Registration;
|
||||
pub use crate::requests::{
|
||||
AddFilterRequest,
|
||||
AddPushRequest,
|
||||
StatusesRequest,
|
||||
UpdateCredsRequest,
|
||||
UpdatePushRequest,
|
||||
use crate::{
|
||||
entities::prelude::*,
|
||||
http_send::{HttpSend, HttpSender},
|
||||
page::Page,
|
||||
};
|
||||
pub use crate::status_builder::{NewStatus, StatusBuilder};
|
||||
|
||||
pub use crate::{
|
||||
data::Data,
|
||||
errors::{ApiError, Error, Result},
|
||||
mastodon_client::{MastodonClient, MastodonUnauthenticated},
|
||||
media_builder::MediaBuilder,
|
||||
registration::Registration,
|
||||
requests::{
|
||||
AddFilterRequest,
|
||||
AddPushRequest,
|
||||
StatusesRequest,
|
||||
UpdateCredsRequest,
|
||||
UpdatePushRequest,
|
||||
},
|
||||
status_builder::{NewStatus, StatusBuilder},
|
||||
};
|
||||
pub use isolang::Language;
|
||||
|
||||
/// Registering your App
|
||||
pub mod apps;
|
||||
@@ -129,14 +129,16 @@ pub mod status_builder;
|
||||
mod macros;
|
||||
/// Automatically import the things you need
|
||||
pub mod prelude {
|
||||
pub use crate::scopes::Scopes;
|
||||
pub use crate::Data;
|
||||
pub use crate::Mastodon;
|
||||
pub use crate::MastodonClient;
|
||||
pub use crate::NewStatus;
|
||||
pub use crate::Registration;
|
||||
pub use crate::StatusBuilder;
|
||||
pub use crate::StatusesRequest;
|
||||
pub use crate::{
|
||||
scopes::Scopes,
|
||||
Data,
|
||||
Mastodon,
|
||||
MastodonClient,
|
||||
NewStatus,
|
||||
Registration,
|
||||
StatusBuilder,
|
||||
StatusesRequest,
|
||||
};
|
||||
}
|
||||
|
||||
/// Your mastodon application client, handles all requests to and from Mastodon.
|
||||
@@ -473,7 +475,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
@@ -492,7 +495,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
@@ -511,7 +515,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
@@ -531,7 +536,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
@@ -551,7 +557,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
@@ -571,7 +578,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
@@ -590,7 +598,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
@@ -631,7 +640,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// WebSocket newtype so that EventStream can be implemented without coherency issues
|
||||
/// WebSocket newtype so that EventStream can be implemented without coherency
|
||||
/// issues
|
||||
pub struct WebSocket(tungstenite::protocol::WebSocket<AutoStream>);
|
||||
|
||||
/// A type that streaming events can be read from
|
||||
@@ -684,12 +694,12 @@ impl<R: EventStream> EventReader<R> {
|
||||
fn make_event(&self, lines: &[String]) -> Result<Event> {
|
||||
let event;
|
||||
let data;
|
||||
if let Some(event_line) = lines
|
||||
.iter()
|
||||
.find(|line| line.starts_with("event:"))
|
||||
{
|
||||
if let Some(event_line) = lines.iter().find(|line| line.starts_with("event:")) {
|
||||
event = event_line[6..].trim().to_string();
|
||||
data = lines.iter().find(|line| line.starts_with("data:")).map(|x| x[5..].trim().to_string());
|
||||
data = lines
|
||||
.iter()
|
||||
.find(|line| line.starts_with("data:"))
|
||||
.map(|x| x[5..].trim().to_string());
|
||||
} else {
|
||||
use serde::Deserialize;
|
||||
#[derive(Deserialize)]
|
||||
@@ -816,7 +826,8 @@ impl<H: HttpSend> MastodonUnauth<H> {
|
||||
"https" => "wss",
|
||||
x => return Err(Error::Other(format!("Bad URL scheme: {}", x))),
|
||||
};
|
||||
url.set_scheme(new_scheme).map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
url.set_scheme(new_scheme)
|
||||
.map_err(|_| Error::Other("Bad URL scheme!".to_string()))?;
|
||||
|
||||
let client = tungstenite::connect(url.as_str())?.0;
|
||||
|
||||
|
||||
+16
-14
@@ -1,18 +1,20 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::entities::prelude::*;
|
||||
use crate::errors::Result;
|
||||
use crate::http_send::{HttpSend, HttpSender};
|
||||
use crate::media_builder::MediaBuilder;
|
||||
use crate::page::Page;
|
||||
use crate::requests::{
|
||||
AddFilterRequest,
|
||||
AddPushRequest,
|
||||
StatusesRequest,
|
||||
UpdateCredsRequest,
|
||||
UpdatePushRequest,
|
||||
use crate::{
|
||||
entities::prelude::*,
|
||||
errors::Result,
|
||||
http_send::{HttpSend, HttpSender},
|
||||
media_builder::MediaBuilder,
|
||||
page::Page,
|
||||
requests::{
|
||||
AddFilterRequest,
|
||||
AddPushRequest,
|
||||
StatusesRequest,
|
||||
UpdateCredsRequest,
|
||||
UpdatePushRequest,
|
||||
},
|
||||
status_builder::NewStatus,
|
||||
};
|
||||
use crate::status_builder::NewStatus;
|
||||
|
||||
/// Represents the set of methods that a Mastodon Client can do, so that
|
||||
/// implementations might be swapped out for testing
|
||||
@@ -197,11 +199,11 @@ pub trait MastodonClient<H: HttpSend = HttpSender> {
|
||||
fn new_status(&self, status: NewStatus) -> Result<Status> {
|
||||
unimplemented!("This method was not implemented");
|
||||
}
|
||||
/// GET /api/v1/timelines/public?local=true
|
||||
/// GET /api/v1/timelines/public?local=true
|
||||
fn get_local_timeline(&self) -> Result<Page<Status, H>> {
|
||||
unimplemented!("This method was not implemented");
|
||||
}
|
||||
/// GET /api/v1/timelines/public?local=false
|
||||
/// GET /api/v1/timelines/public?local=false
|
||||
fn get_federated_timeline(&self) -> Result<Page<Status, H>> {
|
||||
unimplemented!("This method was not implemented");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::borrow::Cow;
|
||||
use serde::Serialize;
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// A builder pattern struct for constructing a media attachment.
|
||||
#[derive(Debug, Default, Clone, Serialize)]
|
||||
@@ -21,6 +21,7 @@ impl MediaBuilder {
|
||||
focus: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Set an alt text description for the attachment.
|
||||
pub fn description(mut self, description: Cow<'static, str>) -> Self {
|
||||
self.description = Some(description);
|
||||
|
||||
+10
-8
@@ -5,14 +5,16 @@ use serde::Deserialize;
|
||||
use try_from::TryInto;
|
||||
use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET};
|
||||
|
||||
use crate::apps::{App, AppBuilder};
|
||||
use crate::http_send::{HttpSend, HttpSender};
|
||||
use crate::scopes::Scopes;
|
||||
use crate::Data;
|
||||
use crate::Error;
|
||||
use crate::Mastodon;
|
||||
use crate::MastodonBuilder;
|
||||
use crate::Result;
|
||||
use crate::{
|
||||
apps::{App, AppBuilder},
|
||||
http_send::{HttpSend, HttpSender},
|
||||
scopes::Scopes,
|
||||
Data,
|
||||
Error,
|
||||
Mastodon,
|
||||
MastodonBuilder,
|
||||
Result,
|
||||
};
|
||||
|
||||
const DEFAULT_REDIRECT_URI: &'static str = "urn:ietf:wg:oauth:2.0:oob";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::entities::filter::FilterContext;
|
||||
use std::time::Duration;
|
||||
use serde::Serialize;
|
||||
use std::time::Duration;
|
||||
|
||||
/// Form used to create a filter
|
||||
///
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use crate::entities::push::{add_subscription, update_data};
|
||||
use crate::errors::Result;
|
||||
use crate::{
|
||||
entities::push::{add_subscription, update_data},
|
||||
errors::Result,
|
||||
};
|
||||
use serde::Serialize;
|
||||
|
||||
/// Container for the key & auth strings for an AddPushRequest
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::errors::Error;
|
||||
use serde::Serialize;
|
||||
use serde_qs;
|
||||
use std::{borrow::Cow, convert::Into};
|
||||
use serde::Serialize;
|
||||
|
||||
mod bool_qs_serialize {
|
||||
use serde::Serializer;
|
||||
|
||||
@@ -3,9 +3,11 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use crate::entities::account::{Credentials, MetadataField, UpdateSource};
|
||||
use crate::errors::Result;
|
||||
use crate::status_builder;
|
||||
use crate::{
|
||||
entities::account::{Credentials, MetadataField, UpdateSource},
|
||||
errors::Result,
|
||||
status_builder,
|
||||
};
|
||||
|
||||
/// Builder to pass to the Mastodon::update_credentials method
|
||||
///
|
||||
@@ -202,8 +204,10 @@ impl UpdateCredsRequest {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::entities::account::{Credentials, MetadataField, UpdateSource};
|
||||
use crate::status_builder::Visibility;
|
||||
use crate::{
|
||||
entities::account::{Credentials, MetadataField, UpdateSource},
|
||||
status_builder::Visibility,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_update_creds_request_new() {
|
||||
|
||||
+13
-6
@@ -7,8 +7,12 @@ use std::{
|
||||
};
|
||||
|
||||
use crate::errors::Error;
|
||||
use serde::{Deserialize, Deserializer, Serialize};
|
||||
use serde::de::{self, Visitor};
|
||||
use serde::{
|
||||
de::{self, Visitor},
|
||||
Deserialize,
|
||||
Deserializer,
|
||||
Serialize,
|
||||
};
|
||||
|
||||
/// Represents a set of OAuth scopes
|
||||
///
|
||||
@@ -62,15 +66,18 @@ impl<'de> Visitor<'de> for DeserializeScopesVisitor {
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
|
||||
where E: de::Error
|
||||
where
|
||||
E: de::Error,
|
||||
{
|
||||
Scopes::from_str(v).map_err(de::Error::custom)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Scopes {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, <D as Deserializer<'de>>::Error> where
|
||||
D: Deserializer<'de> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, <D as Deserializer<'de>>::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
deserializer.deserialize_str(DeserializeScopesVisitor)
|
||||
}
|
||||
}
|
||||
@@ -762,7 +769,7 @@ mod tests {
|
||||
let expected = format!("\"{}\"", b);
|
||||
assert_eq!(&ser, &expected);
|
||||
|
||||
let des : Scopes = serde_json::from_str(&ser).expect("Couldn't deserialize Scopes");
|
||||
let des: Scopes = serde_json::from_str(&ser).expect("Couldn't deserialize Scopes");
|
||||
assert_eq!(&des, a);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user