pub struct DirParseState {
pub modules: HashMap<String, Query>,
/* private fields */
}Fields§
§modules: HashMap<String, Query>Implementations§
Source§impl DirParseState
impl DirParseState
pub fn new(modules: HashMap<String, Query>) -> Self
pub fn get_module(&self, module: &str) -> Option<&QueryResult>
Sourcepub fn get_module_metadata<T: 'static>(&self, module: &str) -> Option<&T>
pub fn get_module_metadata<T: 'static>(&self, module: &str) -> Option<&T>
Examples found in repository?
examples/basic.rs (line 13)
9 10 11 12 13 14 15 16 17 18 19 20
fn prompt_right(state: State<DirParseState>, sh: &Shell) -> StyledBuf {
let project_info = default_prompt(&state, sh);
let git_branch = state
.get_module_metadata::<Git>("git")
.map(|git| format!("git:{}", git.branch));
styled_buf! {
project_info,
git_branch
}
}Auto Trait Implementations§
impl Freeze for DirParseState
impl !RefUnwindSafe for DirParseState
impl !Send for DirParseState
impl !Sync for DirParseState
impl Unpin for DirParseState
impl !UnwindSafe for DirParseState
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