Skip to content

Instantly share code, notes, and snippets.

@auroranockert
Created February 21, 2014 19:20
Show Gist options
  • Save auroranockert/9141385 to your computer and use it in GitHub Desktop.
Save auroranockert/9141385 to your computer and use it in GitHub Desktop.
#[repr(u32)]
pub enum Status {
Success = 0,
NoMemory = 1,
InvalidMatrix = 5,
TypeMismatch = 13
}
pub mod surface {
use std;
pub struct Surface {
opaque: *std::libc::c_void
}
impl Surface {
pub fn to_png(&self, filename: &str) -> Status {
unsafe {
use std::c_str::ToCStr;
let foreign_result = cairo_surface_write_to_png(self, filename.to_c_str());
return foreign_result;
}
}
}
}
@auroranockert
Copy link
Author

I get the compiler message

cairo.rs:147:45: 147:53 error: use of undeclared type name `Status`
cairo.rs:147     pub fn to_png(&self, filename: &str) -> ::Status {
                                                         ^~~~~~~~
cairo.rs:182:91: 182:99 error: use of undeclared type name `Status`
cairo.rs:182     fn cairo_surface_write_to_png(self_value: *Surface, filename: std::c_str::CString) -> ::Status;
                                                                                                       ^~~~~~~~
cairo.rs:298:29: 298:37 error: use of undeclared type name `Status`
cairo.rs:298     pub fn invert(&self) -> ::Status {
                                         ^~~~~~~~
cairo.rs:318:52: 318:60 error: use of undeclared type name `Status`
cairo.rs:318     fn cairo_matrix_invert(self_value: *Matrix) -> ::Status;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment