Skip to content

Commit

Permalink
add get_path()
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcmicu committed Jan 22, 2024
1 parent 260ce0f commit 7058cbf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,20 @@ impl Valve {
})
}

/// Convenience function to retrieve the path to Valve's "table table", the main entrypoint
/// to Valve's configuration.
pub fn get_path(&self) -> String {
self.config
.get("table")
.and_then(|t| t.as_object())
.and_then(|t| t.get("table"))
.and_then(|t| t.as_object())
.and_then(|t| t.get("path"))
.and_then(|p| p.as_str())
.unwrap()
.to_string()
}

/// Controls the maximum length of a username.
const USERNAME_MAX_LEN: usize = 20;

Expand Down

0 comments on commit 7058cbf

Please sign in to comment.