Struct sourceview5::SnippetContext[][src]

pub struct SnippetContext(_);

Implementations

impl SnippetContext[src]

pub fn new() -> SnippetContext[src]

Creates a new SnippetContext.

Generally, this isn’t needed unless you are controlling the expansion of snippets manually.

Feature: v5_0

Returns

a SnippetContext

pub fn clear_variables(&self)[src]

Removes all variables from the context.

Feature: v5_0

pub fn expand(&self, input: &str) -> Option<GString>[src]

pub fn get_variable(&self, key: &str) -> Option<GString>[src]

Gets the current value for a variable named key.

Feature: v5_0

key

the name of the variable

Returns

the value for the variable, or None

pub fn set_constant(&self, key: &str, value: &str)[src]

Sets a constatnt within the context. This is similar to a variable set with SnippetContext::set_variable but is expected to not change during use of the snippet.

Examples would be the date or users name.

Feature: v5_0

key

the constant name

value

the value of the constant

pub fn set_line_prefix(&self, line_prefix: &str)[src]

pub fn set_tab_width(&self, tab_width: i32)[src]

pub fn set_use_spaces(&self, use_spaces: bool)[src]

pub fn set_variable(&self, key: &str, value: &str)[src]

Sets a variable within the context.

This variable may be overridden by future updates to the context.

Feature: v5_0

key

the variable name

value

the value for the variable

pub fn connect_changed<F: Fn(&SnippetContext) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

The “changed” signal is emitted when a change has been discovered in one of the chunks of the snippet which has caused a variable or other dynamic data within the context to have changed.

Feature: v5_0

Trait Implementations

impl Clone for SnippetContext[src]

impl Debug for SnippetContext[src]

impl Default for SnippetContext[src]

impl Display for SnippetContext[src]

impl Eq for SnippetContext[src]

impl Hash for SnippetContext[src]

impl Ord for SnippetContext[src]

impl ParentClassIs for SnippetContext[src]

type Parent = Object

impl<T: ObjectType> PartialEq<T> for SnippetContext[src]

impl<T: ObjectType> PartialOrd<T> for SnippetContext[src]

impl StaticType for SnippetContext[src]

impl StructuralEq for SnippetContext[src]

Auto Trait Implementations

impl RefUnwindSafe for SnippetContext

impl !Send for SnippetContext

impl !Sync for SnippetContext

impl Unpin for SnippetContext

impl UnwindSafe for SnippetContext

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: SetValue + Send + ToValue + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.