diff --git a/ferrtable/src/client.rs b/ferrtable/src/client.rs index 310f3c9..83664d8 100644 --- a/ferrtable/src/client.rs +++ b/ferrtable/src/client.rs @@ -18,32 +18,15 @@ pub struct Client { token: String, } -// Implement the Default trait so that `derive_builder` will allow fields -// containing the Client type to be defined with `#[builder(setter(skip))]`. -// -// In order to avoid repeating ourselves, this may also be used in -// `new_from_access_token()`. -impl Default for Client { - /// WARNING: Default is implemented only to satisfy trait bound checks - /// internally. You may use it externally as a placeholder value, but be - /// aware that it will not be able to make any authenticated API requests. - fn default() -> Self { - Self { +impl Client { + pub fn new_from_access_token(token: &str) -> Result { + Ok(Self { api_root: DEFAULT_API_ROOT.to_owned(), client: reqwest::ClientBuilder::default() .https_only(true) .build() .expect("reqwest client is always built with the same configuration here"), - token: "".to_owned(), - } - } -} - -impl Client { - pub fn new_from_access_token(token: &str) -> Result { - Ok(Self { token: token.to_owned(), - ..Default::default() }) } diff --git a/ferrtable/src/create_records.rs b/ferrtable/src/create_records.rs index ea1a9bc..b625866 100644 --- a/ferrtable/src/create_records.rs +++ b/ferrtable/src/create_records.rs @@ -45,7 +45,7 @@ pub struct CreateRecordsDetails { pub reasons: Vec, } -impl<'a, T> CreateRecordsQuery +impl CreateRecordsQuery where T: Clone + DeserializeOwned + Serialize, {