Skip to content

Instantly share code, notes, and snippets.

@saivert
Created June 16, 2023 18:08
Show Gist options
  • Save saivert/4cdd4189c21953b7f997475dcc65f660 to your computer and use it in GitHub Desktop.
Save saivert/4cdd4189c21953b7f997475dcc65f660 to your computer and use it in GitHub Desktop.
// Boxed type guide
// Define the boxed type
#[derive(glib::Boxed, Clone, Default)]
#[boxed_type(name = "FloatVec")]
pub struct FloatVec(Vec<f32>);
impl FloatVec {
pub fn get(&self) -> Vec<f32> {
self.0.clone()
}
pub fn set(&self, value: Vec<f32>) {
self.0 = value;
}
}
// Then in your object add:
#[property(get, set)]
myfloatvec: RefCell<FloatVec>,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment