docs: add comment

This commit is contained in:
dusk 2023-05-09 08:30:48 +03:00
parent aea515c047
commit a1c09cd404
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -32,9 +32,12 @@ pub(crate) struct Tokens {
impl Tokens {
pub async fn read(path: impl AsRef<Path>) -> Result<Self, AppError> {
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,
}