From 624a2024646b11d5ecb3f07b3f248bb13fa9cb1f Mon Sep 17 00:00:00 2001 From: Lewin Bormann Date: Wed, 21 Sep 2016 08:37:14 +0200 Subject: [PATCH] docs(helpers): Let service account and helper code show up in rustdoc --- src/helper.rs | 9 +++++++-- src/lib.rs.in | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/helper.rs b/src/helper.rs index bedcd9a..6a3df83 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -11,20 +11,23 @@ use serde_json; use std::io::{self, Read}; use std::fs; +use std::path::Path; use service_account::ServiceAccountKey; use types::{ConsoleApplicationSecret, ApplicationSecret}; -pub fn read_application_secret(file: &String) -> io::Result { +/// Read an application secret from a file. +pub fn read_application_secret(path: &Path) -> io::Result { use std::io::Read; let mut secret = String::new(); - let mut file = try!(fs::OpenOptions::new().read(true).open(file)); + let mut file = try!(fs::OpenOptions::new().read(true).open(path)); try!(file.read_to_string(&mut secret)); parse_application_secret(&secret) } +/// Read an application secret from a JSON string. pub fn parse_application_secret(secret: &String) -> io::Result { let result: serde_json::Result = serde_json::from_str(secret); match result { @@ -45,6 +48,8 @@ pub fn parse_application_secret(secret: &String) -> io::Result io::Result { let mut key = String::new(); let mut file = try!(fs::OpenOptions::new().read(true).open(path)); diff --git a/src/lib.rs.in b/src/lib.rs.in index 6a8c219..a6cad6c 100644 --- a/src/lib.rs.in +++ b/src/lib.rs.in @@ -31,3 +31,4 @@ pub use authenticator::{Authenticator, Retry, GetToken}; pub use authenticator_delegate::{AuthenticatorDelegate, DefaultAuthenticatorDelegate, PollError, PollInformation}; pub use helper::*; +pub use service_account::*;