pub struct VimVar<Name: AsRef<str>> { /* private fields */ }
Expand description
Represents a vim variable to be extracted
Implementations§
Source§impl<Name: AsRef<str>> VimVar<Name>
impl<Name: AsRef<str>> VimVar<Name>
Source§impl<Name: AsRef<str>> VimVar<Name>
impl<Name: AsRef<str>> VimVar<Name>
Sourcepub fn load_typed<T>(&self, allow_zero: bool) -> Result<Option<T>>where
T: DeserializeOwned,
pub fn load_typed<T>(&self, allow_zero: bool) -> Result<Option<T>>where
T: DeserializeOwned,
Loads variable with Self::load
and then attempts to convert it
to the specified type
§Notes
- If
allow_zero
is true, then a value of 0 is considered the value of the variable rather than vim’s default of not being found
Sourcepub fn load(&self, allow_zero: bool) -> Result<Option<Value>>
pub fn load(&self, allow_zero: bool) -> Result<Option<Value>>
Loads the variable’s value using neovim’s headless mode or vim’s ex mode using the default vimrc available in scope
§Notes
- Will leverage
search::find_vimrc
to load in the appropriate vimrc during ex mode - If
allow_zero
is true, then a value of 0 is considered the value of the variable rather than vim’s default of not being found
Sourcepub fn load_typed_with_config<P: AsRef<Path>, T>(
&self,
config: P,
allow_zero: bool,
) -> Result<Option<T>>where
T: DeserializeOwned,
pub fn load_typed_with_config<P: AsRef<Path>, T>(
&self,
config: P,
allow_zero: bool,
) -> Result<Option<T>>where
T: DeserializeOwned,
Loads variable with Self::load_with_config
and then attempts to
convert it to the specified type
§Notes
- If
allow_zero
is true, then a value of 0 is considered the value of the variable rather than vim’s default of not being found
Sourcepub fn load_with_config<P: AsRef<Path>>(
&self,
config: P,
allow_zero: bool,
) -> Result<Option<Value>>
pub fn load_with_config<P: AsRef<Path>>( &self, config: P, allow_zero: bool, ) -> Result<Option<Value>>
Loads the variable’s value using neovim’s headless mode or vim’s ex mode
§Notes
- Spawns a vim process whose goal is to print out the contents of a variable as a JSON string
- Leverages batch & ex modes with redir to execute and capture output
- Relies on the variable being available upon loading vim configs
- If
allow_zero
is true, then a value of 0 is considered the value of the variable rather than vim’s default of not being found
Trait Implementations§
impl<Name: Eq + AsRef<str>> Eq for VimVar<Name>
impl<Name: AsRef<str>> StructuralPartialEq for VimVar<Name>
Auto Trait Implementations§
impl<Name> Freeze for VimVar<Name>where
Name: Freeze,
impl<Name> RefUnwindSafe for VimVar<Name>where
Name: RefUnwindSafe,
impl<Name> Send for VimVar<Name>where
Name: Send,
impl<Name> Sync for VimVar<Name>where
Name: Sync,
impl<Name> Unpin for VimVar<Name>where
Name: Unpin,
impl<Name> UnwindSafe for VimVar<Name>where
Name: UnwindSafe,
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