Function modify_buffer_data

Source
fn modify_buffer_data<'ob, T>(
    object: Gc<ObjectType<'ob>>,
    env: &'ob mut Rt<Env<'_>>,
    func: impl FnOnce(&mut BufferData) -> Result<T>,
) -> Result<T>
Expand description

Helper function to safely modify buffer data.

Takes an object (buffer or nil) and environment, and applies the given function to the buffer’s data. Handles both current buffer and other buffers safely.

§Arguments

  • object - The buffer object to modify (or nil for current buffer)
  • env - The environment containing buffer state
  • func - Function to apply to the buffer’s data

§Returns

Result containing the return value from func or an error