From 7f33cf22a5c22e3cc50dcc199604af78ba8e13fa Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 15 Mar 2015 11:37:19 +0100 Subject: [PATCH] feat(docs): add cargo.toml dependency information Fixes #10 --- gen/youtube3/README.md | 20 +++++++++++++++----- gen/youtube3/src/lib.rs | 31 +++++++++++++++++++++---------- src/mako/lib/lib.mako | 20 +++++++++++++++----- 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/gen/youtube3/README.md b/gen/youtube3/README.md index 08dcd80c7b..0bdc11d12e 100644 --- a/gen/youtube3/README.md +++ b/gen/youtube3/README.md @@ -70,6 +70,15 @@ The `doit()` method performs the actual communication with the server and return # Usage +## Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +youtube3 = "0.0.1" +``` + ## A complete example ```Rust @@ -82,13 +91,14 @@ use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; use youtube3::YouTube; -// Get an ApplicationSecret instance by some means. It contains the `client_id` and `client_secret`, -// among other things. +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. let secret: ApplicationSecret = Default::default(); // Instantiate the authenticator. It will choose a suitable authentication flow for you, -// unless you replace `None` with the desired Flow -// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about what's going on -// You probably want to bring in your own `TokenStorage` to persist tokens and retrieve them from storage. +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(), ::default(), None); diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index fe50609dc5..f811293e80 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -69,6 +69,15 @@ //! //! # Usage //! +//! ## Setting up your Project +//! +//! To use this library, you would put the following lines into your `Cargo.toml` file: +//! +//! ```toml +//! [dependencies] +//! youtube3 = "0.0.1" +//! ``` +//! //! ## A complete example //! //! ```test_harness,no_run @@ -82,13 +91,14 @@ //! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; //! use youtube3::YouTube; //! -//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and `client_secret`, -//! // among other things. +//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and +//! // `client_secret`, among other things. //! let secret: ApplicationSecret = Default::default(); //! // Instantiate the authenticator. It will choose a suitable authentication flow for you, -//! // unless you replace `None` with the desired Flow -//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about what's going on -//! // You probably want to bring in your own `TokenStorage` to persist tokens and retrieve them from storage. +//! // unless you replace `None` with the desired Flow. +//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +//! // retrieve them from storage. //! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, //! hyper::Client::new(), //! ::default(), None); @@ -267,13 +277,14 @@ impl Default for Scope { /// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// use youtube3::YouTube; /// -/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and `client_secret`, -/// // among other things. +/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and +/// // `client_secret`, among other things. /// let secret: ApplicationSecret = Default::default(); /// // Instantiate the authenticator. It will choose a suitable authentication flow for you, -/// // unless you replace `None` with the desired Flow -/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about what's going on -/// // You probably want to bring in your own `TokenStorage` to persist tokens and retrieve them from storage. +/// // unless you replace `None` with the desired Flow. +/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +/// // retrieve them from storage. /// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// hyper::Client::new(), /// ::default(), None); diff --git a/src/mako/lib/lib.mako b/src/mako/lib/lib.mako index 3f1076af8c..07bbf62de9 100644 --- a/src/mako/lib/lib.mako +++ b/src/mako/lib/lib.mako @@ -102,6 +102,15 @@ The `${api.terms.action}()` method performs the actual communication with the se # Usage +${'##'} Setting up your Project + +To use this library, you would put the following lines into your `Cargo.toml` file: + +```toml +[dependencies] +${util.library_name()} = "${cargo.build_version}" +``` + ${'##'} A complete example ${self.hub_usage_example(c, rust_doc, fr=fr)}\ @@ -157,15 +166,16 @@ use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, Mem use ${util.library_name()}::${hub_type}; % if comments: -// Get an ApplicationSecret instance by some means. It contains the `client_id` and `client_secret`, -// among other things. +// Get an ApplicationSecret instance by some means. It contains the `client_id` and +// `client_secret`, among other things. % endif let secret: ApplicationSecret = Default::default(); % if comments: // Instantiate the authenticator. It will choose a suitable authentication flow for you, -// unless you replace `None` with the desired Flow -// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about what's going on -// You probably want to bring in your own `TokenStorage` to persist tokens and retrieve them from storage. +// unless you replace `None` with the desired Flow. +// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about +// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and +// retrieve them from storage. % endif let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::new(),