pub unsafe fn lock_edit<F: FnMut(*mut u8)>(&mut self, mut op: F) -> Result<(), String> {
    let lock_output = SDL_LockSurface(self.ptr);
    if lock_output == 0 {
      op((*self.ptr).pixels as *mut u8);
      SDL_UnlockSurface(self.ptr);
      Ok(())
    } else {
      Err(get_error())
    }
  }
/// Lock, edit, unlock, as one easy cycle.
///
/// If the Surface cannot be locked you'll get an error, otherwise your
/// closure will be called with the base pointer to the Surface's pixel data.
///
/// # Safety
///
/// * You can't store the pointer and use it past the closure
/// * You have to follow standard 2D raw pixel editing rules.
///   * `y * pitch + x * size_of::<PixelType>()`
///   * Stay in bounds and all that jazz
Lock, edit, unlock, as one easy cycle.
If the Surface cannot be locked you'll get an error, otherwise your
closure will be called with the base pointer to the Surface's pixel data.
Lock edit unlock as one easy cycle . If the Surface cannot be locked you ' ll get an error otherwise your closure will be called with the base pointer to the Surface ' s pixel data .
pub unsafe fn lock_edit<F: FnMut(*mut u8)>(&mut self, mut op: F) -> Result<(), String> {
    let lock_output = SDL_LockSurface(self.ptr);
    if lock_output == 0 {
      op((*self.ptr).pixels as *mut u8);
      SDL_UnlockSurface(self.ptr);
      Ok(())
    } else {
      Err(get_error())
    }
  }
pub unsafe fn lock_edit < F : FnMut ( * mut u8 ) > ( & mut self , mut op : F ) -> Result < ( ) , String > { let lock_output = SDL_LockSurface ( self . ptr ) ; if lock_output == 0 { op ( ( * self . ptr ) . pixels as * mut u8 ) ; SDL_UnlockSurface ( self . ptr ) ; Ok ( ( ) ) } else { Err ( get_error ( ) ) } }
Lock, edit, unlock, as one easy cycle.
Lock edit unlock as one easy cycle .
&mut self
op
F
&mut self
op
F
safety
You can't store the pointer and use it past the closure
You have to follow standard 2D raw pixel editing rules.
`y * pitch + x * size_of::()`
Stay in bounds and all that jazz
You can ' t store the pointer and use it past the closure You have to follow standard 2D raw pixel editing rules . ` y * pitch + x * size_of :: () ` Stay in bounds and all that jazz