pub enum UpdateTextureError {
WrongDataSize {
expect: usize,
actual: usize,
},
OutOfBounds,
NegativeSize,
}Expand description
Errors returned when updating texture data on the GPU.
§Examples
use raylib::core::error::UpdateTextureError;
fn handle(e: UpdateTextureError) {
match e {
UpdateTextureError::WrongDataSize { expect, actual } => {
eprintln!("texture expects {expect} bytes, got {actual}");
}
UpdateTextureError::OutOfBounds => eprintln!("region exceeds texture bounds"),
UpdateTextureError::NegativeSize => eprintln!("region has negative extents"),
}
}Variants§
WrongDataSize
The pixel-buffer slice does not match the byte size of the texture region.
Cause: raylib-rs computed width * height * bytes_per_pixel for the target
region and the supplied slice was a different length; passing it to
ffi::UpdateTexture would read out of bounds.
Recovery: Size the input buffer to exactly expect bytes (region width times
height times bytes per pixel for the texture’s format).
Fields
OutOfBounds
The destination rectangle extends past the texture’s width or height.
Cause: The rectangle’s x + width or y + height exceeds the texture
dimensions; raylib-rs blocks this before ffi::UpdateTextureRec
would otherwise overflow.
Recovery: Clamp the rectangle so it lies entirely within the texture’s bounds.
NegativeSize
The destination rectangle has a negative width or height.
Cause: raylib treats the rectangle’s width/height as unsigned at the FFI
boundary; raylib-rs rejects negative values up front so they cannot wrap into very
large positive sizes.
Recovery: Pass non-negative extents; swap the corners if the caller’s coordinates were inverted.
Trait Implementations§
Source§impl Debug for UpdateTextureError
impl Debug for UpdateTextureError
Source§impl Display for UpdateTextureError
impl Display for UpdateTextureError
Source§impl Error for UpdateTextureError
impl Error for UpdateTextureError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()