pub fn resize(&mut self, new_size: i32) -> Result<(), nix::Error> {
        let new_size: usize = new_size.try_into().unwrap();
        if self.size == new_size {
            return Ok(());
        }

        // allocate the space (retry on interrupt)
        loop {
            match ftruncate(self.inner, new_size.try_into().unwrap()) {
                Ok(()) => {
                    self.size = new_size;
                    return Ok(());
                }
                Err(e) if matches!(e.as_errno(), Some(Errno::EINTR)) => {
                    // continue (try again)
                }
                Err(e) => {
                    return Err(e);
                }
            }
        }
    }
/// Resizes the shared memory pool.
///
/// This is almost certainly unsafe if the server is using the memory TODO use locking
/// (provided by wayland I think).
Resizes the shared memory pool.
This is almost certainly unsafe if the server is using the memory TODO use locking
(provided by wayland I think).
Resizes the shared memory pool . This is almost certainly unsafe if the server is using the memory TODO use locking ( provided by wayland I think ) .
pub fn resize(&mut self, new_size: i32) -> Result<(), nix::Error> {
        let new_size: usize = new_size.try_into().unwrap();
        if self.size == new_size {
            return Ok(());
        }
        // allocate the space (retry on interrupt)
        loop {
            match ftruncate(self.inner, new_size.try_into().unwrap()) {
                Ok(()) => {
                    self.size = new_size;
                    return Ok(());
                }
                Err(e) if matches!(e.as_errno(), Some(Errno::EINTR)) => {
                    // continue (try again)
                }
                Err(e) => {
                    return Err(e);
                }
            }
        }
    }
pub fn resize ( & mut self , new_size : i32 ) -> Result < ( ) , nix :: Error > { let new_size : usize = new_size . try_into ( ) . unwrap ( ) ; if self . size == new_size { return Ok ( ( ) ) ; } // allocate the space (retry on interrupt) loop { match ftruncate ( self . inner , new_size . try_into ( ) . unwrap ( ) ) { Ok ( ( ) ) => { self . size = new_size ; return Ok ( ( ) ) ; } Err ( e ) if matches ! ( e as_errno ( ) Some ( Errno EINTR ) ) => { // continue (try again) } Err ( e ) => { return Err ( e ) ; } } } }
Resizes the shared memory pool.
Resizes the shared memory pool .
&mut self
new_size
i32
&mut self
new_size
i32