From a1c09cd404fd9969165e64e613823008e19a5c23 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Tue, 9 May 2023 08:30:48 +0300 Subject: [PATCH] docs: add comment --- src/token.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/token.rs b/src/token.rs index 4849730..3d8a98e 100644 --- a/src/token.rs +++ b/src/token.rs @@ -32,9 +32,12 @@ pub(crate) struct Tokens { impl Tokens { pub async fn read(path: impl AsRef) -> Result { + let tokens = tokio::fs::read_to_string(path).await?; let this = Self { hashed: Arc::new(HashSet::new()), - raw_contents: Box::leak(tokio::fs::read_to_string(path).await?.into_boxed_str()), + // this is okay since we only call this once and it will be + // used for all of it's lifetime + raw_contents: Box::leak(tokens.into_boxed_str()), }; for token in this.raw_contents.lines() { @@ -118,7 +121,7 @@ impl MusicScopedTokens { } #[derive(Clone)] -pub(crate) struct MusicScopedToken { +struct MusicScopedToken { creation: u64, music_id: String, }