make apps::prelude and use the preludes in the tests

This commit is contained in:
Paul Woolcock
2018-08-22 13:53:54 -04:00
parent 63d09c1113
commit e5175f09fe
5 changed files with 21 additions and 11 deletions
+11 -1
View File
@@ -1,8 +1,18 @@
use std::fmt;
pub mod prelude {
pub use {
apps::{
AppBuilder,
Scopes
},
registration::Registration
};
}
/// Builder struct for defining your application.
/// ```
/// use elefren::apps::{AppBuilder, Scopes};
/// use elefren::apps::prelude::*;
///
/// let app = AppBuilder {
/// client_name: "elefren_test",
+1 -1
View File
@@ -5,7 +5,7 @@ use serde::Deserialize;
///
/// ```no_run
/// # extern crate elefren;
/// # use elefren::{Data, Mastodon, MastodonClient};
/// # use elefren::prelude::*;
/// # use std::error::Error;
/// # fn main() -> Result<(), Box<Error>> {
/// # let data = Data {
+5 -5
View File
@@ -9,8 +9,8 @@
//! # try().unwrap();
//! # }
//! # fn try() -> elefren::Result<()> {
//! use elefren::{MastodonClient, Registration};
//! use elefren::apps::{AppBuilder, Scopes};
//! use elefren::prelude::*;
//! use elefren::apps::prelude::*;
//!
//! let app = AppBuilder {
//! client_name: "elefren_test",
@@ -74,7 +74,7 @@ pub mod requests;
#[macro_use] mod macros;
/// Automatically import the things you need
pub mod prelude {
pub use {Mastodon, MastodonClient, StatusBuilder, StatusesRequest};
pub use {Data, Mastodon, MastodonClient, StatusBuilder, StatusesRequest};
}
/// Your mastodon application client, handles all requests to and from Mastodon.
@@ -324,7 +324,7 @@ impl MastodonClient for Mastodon {
///
/// ```no_run
/// # extern crate elefren;
/// # use elefren::{Data, Mastodon, MastodonClient};
/// # use elefren::prelude::*;
/// # use std::error::Error;
/// # fn main() -> Result<(), Box<Error>> {
/// # let data = Data {
@@ -342,7 +342,7 @@ impl MastodonClient for Mastodon {
///
/// ```no_run
/// # extern crate elefren;
/// # use elefren::{Data, Mastodon, MastodonClient, StatusesRequest};
/// # use elefren::prelude::*;
/// # use std::error::Error;
/// # fn main() -> Result<(), Box<Error>> {
/// # let data = Data {
+3 -3
View File
@@ -34,7 +34,7 @@ struct AccessToken {
impl Registration {
/// Construct a new registration process to the instance of the `base` url.
/// ```
/// use elefren::registration::Registration;
/// use elefren::apps::prelude::*;
///
/// let registration = Registration::new("https://mastodon.social");
/// ```
@@ -57,8 +57,8 @@ impl Registration {
/// # try().unwrap();
/// # }
/// # fn try() -> elefren::Result<()> {
/// use elefren::{MastodonClient, Registration};
/// use elefren::apps::{AppBuilder, Scopes};
/// use elefren::prelude::*;
/// use elefren::apps::prelude::*;
///
/// let app = AppBuilder {
/// client_name: "elefren_test",
+1 -1
View File
@@ -41,7 +41,7 @@ impl StatusBuilder {
/// Create a new status with text.
/// ```
/// use elefren::status_builder::StatusBuilder;
/// use elefren::prelude::*;
///
/// let status = StatusBuilder::new("Hello World!".into());
/// ```