[][src]Struct weechat::buffer::Buffer

pub struct Buffer<'a> { /* fields omitted */ }

A Weechat buffer.

A buffer contains the data displayed on the screen.

Implementations

impl<'_> Buffer<'_>[src]

pub fn print(&self, message: &str)[src]

Display a message on the buffer.

pub fn print_date_tags(&self, date: i64, tags: &[&str], message: &str)[src]

Display a message on the buffer with attached date and tags

Arguments

  • date - A unix time-stamp representing the date of the message, 0 means now.

  • tags - A list of tags that will be applied to the printed line.

  • message - The message that will be displayed.

pub fn search_nicklist_group(&self, name: &str) -> Option<NickGroup<'_>>[src]

Search for a nicklist group by name

Arguments

  • name - The name of the nicklist that should be searched for.

Returns a NickGroup if one is found, None otherwise.

pub fn search_nick(&self, nick: &str) -> Option<Nick<'_>>[src]

Search for a nick in the whole nicklist.

Arguments

  • nick - The name of the nick that should be found.

Returns a Nick if one is found, None otherwise.

pub fn add_nick(&self, nick_settings: NickSettings<'_>) -> Result<Nick<'_>, ()>[src]

Create and add a new nick to the buffer nicklist.

This will add the nick to the root nick group.

Arguments

  • nick_settings - Nick arguments struct for the nick that should be added.

Returns the newly created nick if one is created successfully, an empty error otherwise.

pub fn remove_nicklist_group(&self, group_name: &str) -> bool[src]

Removes a group from the nicklist.

Arguments

  • group_name - The name of the group that should be removed.

Returns true if a group was found and removed, false otherwise.

pub fn remove_nick(&self, nick: &str) -> bool[src]

Removes a nick from the nicklist.

Arguments

  • nick - The name of the nick that should be removed.

Returns true if a nick was found and removed, false otherwise.

pub fn add_nicklist_group(
    &self,
    name: &str,
    color: &str,
    visible: bool,
    parent_group: Option<&NickGroup<'_>>
) -> Result<NickGroup<'_>, ()>
[src]

Create and add a new nicklist group to the buffers nicklist.

  • name - Name of the new group.

  • color - Color of the new group.

  • visible - Should the group be visible in the nicklist.

  • parent_group - Parent group that the group should be added to. If no group is provided the group is added to the root group.

Returns the new nicklist group. The group is not removed if the object is dropped.

pub fn get_localvar(&self, property: &str) -> Option<Cow<'_, str>>[src]

Get the value of a buffer localvar

Arguments

  • property - The name of the property for which the value should be fetched.

pub fn set_localvar(&self, property: &str, value: &str)[src]

Set the value of a buffer localvar

Arguments

  • property - The property that should be set.

  • value - The value that the property should get.

pub fn full_name(&self) -> Cow<'_, str>[src]

Get the full name of the buffer.

pub fn set_full_name(&self, name: &str)[src]

Set the full name of the buffer

Arguments

  • name - The new full name that should be set.

pub fn name(&self) -> Cow<'_, str>[src]

Get the name of the buffer.

pub fn set_name(&self, name: &str)[src]

Set the name of the buffer.

Arguments

  • name - The new name that should be set.

pub fn short_name(&self) -> Cow<'_, str>[src]

Get the short_name of the buffer.

pub fn set_short_name(&self, name: &str)[src]

Set the short_name of the buffer.

Arguments

  • name - The new short name that should be set.

pub fn plugin_name(&self) -> Cow<'_, str>[src]

Get the plugin name of the plugin that owns this buffer.

pub fn disable_time_for_each_line(&self)[src]

Hide time for all lines in the buffer.

pub fn disable_nicklist(&self)[src]

Disable the nicklist for this buffer.

pub fn enable_nicklist(&self)[src]

Enable the nicklist for this buffer.

pub fn title(&self)[src]

Get the title of the buffer

pub fn set_title(&self, title: &str)[src]

Set the title of the buffer.

Arguments

  • title - The new title that will be set.

pub fn disable_log(&self)[src]

Disable logging for this buffer.

pub fn clear(&self)[src]

Clear buffer contents

pub fn close(&self)[src]

Close the buffer.

Note that this will only queue up the buffer to be closed. The close callback will first be run, only then will the buffer be closed.

Multiple calls to this method will result in a nop.

pub fn input(&self) -> Cow<'_, str>[src]

Get the contents of the input

pub fn set_input(&self, input: &str)[src]

Set the content of the buffer input.

pub fn input_position(&self) -> i32[src]

Get the position of the cursor in the buffer input.

pub fn set_input_position(&self, position: i32)[src]

Set the position of the input buffer.

Arguments

  • position - The new position of the input.

pub fn number(&self) -> i32[src]

Get the number of the buffer.

pub fn switch_to(&self)[src]

Switch to the buffer

pub fn run_command(&self, command: &str) -> Result<(), ()>[src]

Run the given command in the buffer.

Arguments

  • command - The command that should run.

Example


// Switch to the core buffer using a command.
buffer.run_command("/buffer core");

pub fn num_lines(&self) -> i32[src]

Get the number of lines that the buffer has printed out.

pub fn lines(&self) -> BufferLines<'_>

Notable traits for BufferLines<'a>

impl<'a> Iterator for BufferLines<'a> type Item = BufferLine<'a>;
[src]

Get the lines of the buffer.

This returns an iterator over all the buffer lines, the iterator can be traversed forwards (from the first line of the buffer, to the last) as well as backwards (from the last line of the buffer to the first).

Example


let lines = buffer.lines();

for line in lines {
    Weechat::print(&format!("{:?}", line.tags()));
}

Trait Implementations

impl<'a> Debug for Buffer<'a>[src]

impl<'_> Eq for Buffer<'_>[src]

impl<'a> Into<SignalData<'a>> for Buffer<'a>[src]

impl<'a> Into<SignalData<'a>> for &'a Buffer<'a>[src]

impl<'_> Ord for Buffer<'_>[src]

impl<'_> PartialEq<Buffer<'_>> for Buffer<'_>[src]

impl<'_> PartialOrd<Buffer<'_>> for Buffer<'_>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Buffer<'a>

impl<'a> !Send for Buffer<'a>

impl<'a> !Sync for Buffer<'a>

impl<'a> Unpin for Buffer<'a>

impl<'a> !UnwindSafe for Buffer<'a>

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<T> From<T> for T[src]

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

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.