<NME> mod.rs
<BEF> //! Buffer management traits.
//!
//! This module provides the [`BufferHandler`] trait to notify compositors that a
//! [`WlBuffer`](wayland_server::protocol::wl_buffer::WlBuffer) managed by
//! Smithay has been destroyed.

use wayland_server::protocol::wl_buffer;

/// Handler trait for associating data with a [`WlBuffer`](wayland_server::protocol::wl_buffer::WlBuffer).
///
/// This trait primarily allows compositors to be told when a buffer is destroyed.
///
/// # For buffer abstractions
///
/// Buffer abstractions (such as [`shm`](crate::wayland::shm)) should require this trait in their
/// [`DelegateDispatch`](wayland_server::DelegateDispatch) implementations to notify the compositor when a
/// buffer is destroyed.
pub trait BufferHandler {
    /// Called when the client has destroyed the buffer.
    ///
    /// At this point the buffer is no longer usable by Smithay.
    fn buffer_destroyed(&mut self, buffer: &wl_buffer::WlBuffer);
}
    }

    /// Creates a [`Buffer`] from a [`WlBuffer`].
    pub fn from_buffer(buffer: &WlBuffer, dh: &mut DisplayHandle<'_>) -> Buffer {
        match dh.get_object_data(buffer.id()) {
            Ok(data) => {
                match data.downcast::<BufferData>() {

<MSG> Buffer::from_buffer -> Buffer::from_wl

<DFF> @@ -55,7 +55,7 @@ impl Buffer {
     }
 
     /// Creates a [`Buffer`] from a [`WlBuffer`].
-    pub fn from_buffer(buffer: &WlBuffer, dh: &mut DisplayHandle<'_>) -> Buffer {
+    pub fn from_wl(buffer: &WlBuffer, dh: &mut DisplayHandle<'_>) -> Buffer {
         match dh.get_object_data(buffer.id()) {
             Ok(data) => {
                 match data.downcast::<BufferData>() {

Buffer::from_buffer -> Buffer::from_wl