From 0fce4a1c16b1c112824f581f81c1eb7af50c3b29 Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 18 Aug 2022 09:02:37 +0100 Subject: [PATCH] add doc comments --- part_1_sbot_rocket/src/main.rs | 2 ++ part_2_subscribe_form/src/sbot.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/part_1_sbot_rocket/src/main.rs b/part_1_sbot_rocket/src/main.rs index 1833582..a287a59 100644 --- a/part_1_sbot_rocket/src/main.rs +++ b/part_1_sbot_rocket/src/main.rs @@ -3,6 +3,7 @@ use std::env; use golgi::{sbot::Keystore, Sbot}; use rocket::{get, launch, routes}; +/// Initialise a connection to a Scuttlebutt server. async fn init_sbot() -> Result { let go_sbot_port = env::var("GO_SBOT_PORT").unwrap_or_else(|_| "8021".to_string()); @@ -15,6 +16,7 @@ async fn init_sbot() -> Result { .map_err(|e| e.to_string()) } +/// Return the public key of the local sbot instance. async fn whoami() -> Result { let mut sbot = init_sbot().await?; sbot.whoami().await.map_err(|e| e.to_string()) diff --git a/part_2_subscribe_form/src/sbot.rs b/part_2_subscribe_form/src/sbot.rs index 8af0514..618d5fa 100644 --- a/part_2_subscribe_form/src/sbot.rs +++ b/part_2_subscribe_form/src/sbot.rs @@ -2,6 +2,7 @@ use std::env; use golgi::{api::friends::RelationshipQuery, sbot::Keystore, Sbot}; +/// Initialise a connection to a Scuttlebutt server. pub async fn init_sbot() -> Result { let go_sbot_port = env::var("GO_SBOT_PORT").unwrap_or_else(|_| "8021".to_string()); @@ -14,12 +15,16 @@ pub async fn init_sbot() -> Result { .map_err(|e| e.to_string()) } +/// Return the public key of the local sbot instance. pub async fn whoami() -> Result { let mut sbot = init_sbot().await?; sbot.whoami().await.map_err(|e| e.to_string()) } +/// Check follow status. +/// +/// Is peer A (`public_key_a`) following peer B (`public_key_b`)? pub async fn is_following(public_key_a: &str, public_key_b: &str) -> Result { let mut sbot = init_sbot().await?;