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

master
Paul Woolcock 6 years ago
parent 63d09c1113
commit e5175f09fe
  1. 12
      src/apps.rs
  2. 2
      src/entities/itemsiter.rs
  3. 10
      src/lib.rs
  4. 6
      src/registration.rs
  5. 2
      src/status_builder.rs

@ -1,8 +1,18 @@
use std::fmt; use std::fmt;
pub mod prelude {
pub use {
apps::{
AppBuilder,
Scopes
},
registration::Registration
};
}
/// Builder struct for defining your application. /// Builder struct for defining your application.
/// ``` /// ```
/// use elefren::apps::{AppBuilder, Scopes}; /// use elefren::apps::prelude::*;
/// ///
/// let app = AppBuilder { /// let app = AppBuilder {
/// client_name: "elefren_test", /// client_name: "elefren_test",

@ -5,7 +5,7 @@ use serde::Deserialize;
/// ///
/// ```no_run /// ```no_run
/// # extern crate elefren; /// # extern crate elefren;
/// # use elefren::{Data, Mastodon, MastodonClient}; /// # use elefren::prelude::*;
/// # use std::error::Error; /// # use std::error::Error;
/// # fn main() -> Result<(), Box<Error>> { /// # fn main() -> Result<(), Box<Error>> {
/// # let data = Data { /// # let data = Data {

@ -9,8 +9,8 @@
//! # try().unwrap(); //! # try().unwrap();
//! # } //! # }
//! # fn try() -> elefren::Result<()> { //! # fn try() -> elefren::Result<()> {
//! use elefren::{MastodonClient, Registration}; //! use elefren::prelude::*;
//! use elefren::apps::{AppBuilder, Scopes}; //! use elefren::apps::prelude::*;
//! //!
//! let app = AppBuilder { //! let app = AppBuilder {
//! client_name: "elefren_test", //! client_name: "elefren_test",
@ -74,7 +74,7 @@ pub mod requests;
#[macro_use] mod macros; #[macro_use] mod macros;
/// Automatically import the things you need /// Automatically import the things you need
pub mod prelude { 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. /// Your mastodon application client, handles all requests to and from Mastodon.
@ -324,7 +324,7 @@ impl MastodonClient for Mastodon {
/// ///
/// ```no_run /// ```no_run
/// # extern crate elefren; /// # extern crate elefren;
/// # use elefren::{Data, Mastodon, MastodonClient}; /// # use elefren::prelude::*;
/// # use std::error::Error; /// # use std::error::Error;
/// # fn main() -> Result<(), Box<Error>> { /// # fn main() -> Result<(), Box<Error>> {
/// # let data = Data { /// # let data = Data {
@ -342,7 +342,7 @@ impl MastodonClient for Mastodon {
/// ///
/// ```no_run /// ```no_run
/// # extern crate elefren; /// # extern crate elefren;
/// # use elefren::{Data, Mastodon, MastodonClient, StatusesRequest}; /// # use elefren::prelude::*;
/// # use std::error::Error; /// # use std::error::Error;
/// # fn main() -> Result<(), Box<Error>> { /// # fn main() -> Result<(), Box<Error>> {
/// # let data = Data { /// # let data = Data {

@ -34,7 +34,7 @@ struct AccessToken {
impl Registration { impl Registration {
/// Construct a new registration process to the instance of the `base` url. /// 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"); /// let registration = Registration::new("https://mastodon.social");
/// ``` /// ```
@ -57,8 +57,8 @@ impl Registration {
/// # try().unwrap(); /// # try().unwrap();
/// # } /// # }
/// # fn try() -> elefren::Result<()> { /// # fn try() -> elefren::Result<()> {
/// use elefren::{MastodonClient, Registration}; /// use elefren::prelude::*;
/// use elefren::apps::{AppBuilder, Scopes}; /// use elefren::apps::prelude::*;
/// ///
/// let app = AppBuilder { /// let app = AppBuilder {
/// client_name: "elefren_test", /// client_name: "elefren_test",

@ -41,7 +41,7 @@ impl StatusBuilder {
/// Create a new status with text. /// Create a new status with text.
/// ``` /// ```
/// use elefren::status_builder::StatusBuilder; /// use elefren::prelude::*;
/// ///
/// let status = StatusBuilder::new("Hello World!".into()); /// let status = StatusBuilder::new("Hello World!".into());
/// ``` /// ```

Loading…
Cancel
Save