pub struct BookmarkStore {
pub bookmarks: IndexMap<String, Bookmark>,
}Expand description
Persistent store for bookmarks using TOML.
Fields§
§bookmarks: IndexMap<String, Bookmark>Implementations§
Source§impl BookmarkStore
impl BookmarkStore
Sourcepub fn default_path() -> Result<PathBuf, ConfigError>
pub fn default_path() -> Result<PathBuf, ConfigError>
Return the default file path (~/.config/ferrule/bookmarks.toml).
Sourcepub fn load() -> Result<Self, ConfigError>
pub fn load() -> Result<Self, ConfigError>
Load from the default path.
Sourcepub fn load_from_path(path: &Path) -> Result<Self, ConfigError>
pub fn load_from_path(path: &Path) -> Result<Self, ConfigError>
Load from an explicit path.
Sourcepub fn save(&self) -> Result<(), ConfigError>
pub fn save(&self) -> Result<(), ConfigError>
Save to the default path.
Sourcepub fn save_to_path(&self, path: &Path) -> Result<(), ConfigError>
pub fn save_to_path(&self, path: &Path) -> Result<(), ConfigError>
Save to an explicit path.
Sourcepub fn insert(&mut self, name: String, sql: String, connection: Option<String>)
pub fn insert(&mut self, name: String, sql: String, connection: Option<String>)
Insert or overwrite a bookmark.
Sourcepub fn connection_hint(name: &str) -> Option<&str>
pub fn connection_hint(name: &str) -> Option<&str>
Extract the connection hint from a dotted bookmark name.
pg.select_users→Some("pg")count_all→None
Sourcepub fn resolve_params(sql: &str, params: &[String]) -> String
pub fn resolve_params(sql: &str, params: &[String]) -> String
Perform positional substitution of ${1}, ${2}, etc.
Missing parameters leave the placeholder intact.
Trait Implementations§
Source§impl Clone for BookmarkStore
impl Clone for BookmarkStore
Source§fn clone(&self) -> BookmarkStore
fn clone(&self) -> BookmarkStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BookmarkStore
impl Debug for BookmarkStore
Source§impl Default for BookmarkStore
impl Default for BookmarkStore
Source§fn default() -> BookmarkStore
fn default() -> BookmarkStore
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BookmarkStore
impl<'de> Deserialize<'de> for BookmarkStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BookmarkStore
impl RefUnwindSafe for BookmarkStore
impl Send for BookmarkStore
impl Sync for BookmarkStore
impl Unpin for BookmarkStore
impl UnsafeUnpin for BookmarkStore
impl UnwindSafe for BookmarkStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more