From b65be908a8f8afe35095a6a139f19cb914e573ba Mon Sep 17 00:00:00 2001 From: Bram Dingelstad Date: Mon, 20 Mar 2023 11:36:07 +0100 Subject: [PATCH] feat: switched Arc instead of Rc --- src/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6e84c3f..1277cbb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,17 +77,17 @@ fn get_http_client(notion_api_key: &str) -> reqwest::Client { #[allow(unused)] pub struct Client { - http_client: Rc, + http_client: Arc, pub pages: Pages, pub blocks: Blocks, pub databases: Databases } -use std::rc::Rc; +use std::sync::Arc; impl<'a> Client { pub fn new(notion_api_key: &'a str) -> Self { - let http_client = Rc::from(get_http_client(notion_api_key)); + let http_client = Arc::from(get_http_client(notion_api_key)); Client { http_client: http_client.clone(), @@ -103,7 +103,7 @@ pub struct PageOptions<'a> { } pub struct Pages { - http_client: Rc + http_client: Arc } impl Pages { @@ -127,7 +127,7 @@ impl Pages { } pub struct Blocks { - http_client: Rc, + http_client: Arc, } impl Blocks { @@ -139,7 +139,7 @@ impl Blocks { } pub struct BlockChildren { - http_client: Rc, + http_client: Arc, } pub struct BlockChildrenListOptions<'a> { @@ -169,11 +169,11 @@ impl BlockChildren { } pub struct Databases { - http_client: Rc, + http_client: Arc, } impl Databases { - pub async fn query<'a>(self, options: DatabaseQueryOptions<'a>) -> Result> { + pub async fn query<'a>(&self, options: DatabaseQueryOptions<'a>) -> Result> { let url = format!("https://api.notion.com/v1/databases/{database_id}/query", database_id = options.database_id); let mut request = self.http_client