This changes the API from what's in C++ to make the version and flags have their own type, instead of being a simple integer.
CPPMM Checklist
Cppmm is our bindings generator. There are some tools in it to aid in creating safe and stable APIs.
[x] Use CPPMM_RENAME(ctor) for the "main" type constructor.
[x] Add CPPMM_THROWS for any code that may throw an exception in C++.
FFI Safety Checklist
The Rustonomicon provides useful guides to prevent soundness errors in Rust. The FFI section of the document provides the source for these checklist items.
[x] Null pointers are properly handled
[x] Panics in Rust never cross FFI boundary
There is code that can panic (openexr::version::Version::new(...)), but this shouldn't be called on the C++ side.
[x] Types implement drop trait for C/C++ destructors
[x] Concurrency is properly managed between Rust and C/C++
[x] C style strings are converted to CStr or CString
[x] Wrap non-trivially movable types in a Box
Rust API Guidelines Checklist
The checklist is heavily inspired by The Rust API Guidelines. Please check each item that applies, or note if an item is intentionally skipped (either partially or fully) with the reason.
[x] Naming(crate aligns with Rust naming conventions)
Data structures do not duplicate derived trait bounds (C-STRUCT-BOUNDS)
[x] Necessities(to whom they matter, they really matter)
Public dependencies of a stable crate are stable (C-STABLE)
Crate and its dependencies have a permissive license (C-PERMISSIVE)
Testing Checklist
The tests are meant to validate that the wrappers are sound and work as expected. Tests that are designed to exercise code for the wrapped library and not the bindings should be added to the wrapped library instead.
[x] unsafe {} code is properly sanitized
[x] All functions are called at least once in tests
[x] Functions that can round trip data (for example, readers and writers, getters and setters, etc) are verified so that the input and output data are the same (if applicable).
Description
Closes #18.
Implement the
imfVersion
module.This changes the API from what's in C++ to make the version and flags have their own type, instead of being a simple integer.
CPPMM Checklist
Cppmm is our bindings generator. There are some tools in it to aid in creating safe and stable APIs.
CPPMM_RENAME(ctor)
for the "main" type constructor.CPPMM_THROWS
for any code that may throw an exception in C++.FFI Safety Checklist
The Rustonomicon provides useful guides to prevent soundness errors in Rust. The FFI section of the document provides the source for these checklist items.
openexr::version::Version::new(...)
), but this shouldn't be called on the C++ side.CStr
orCString
Box
Rust API Guidelines Checklist
The checklist is heavily inspired by The Rust API Guidelines. Please check each item that applies, or note if an item is intentionally skipped (either partially or fully) with the reason.
as_
,to_
,into_
conventions (C-CONV)iter
,iter_mut
,into_iter
(C-ITER)Copy
,Clone
,Eq
,PartialEq
,Ord
,PartialOrd
,Hash
,Debug
,Display
,Default
From
,AsRef
,AsMut
(C-CONV-TRAITS)FromIterator
andExtend
(C-COLLECT)Serialize
,Deserialize
(C-SERDE)Send
andSync
where possible (C-SEND-SYNC)Hex
,Octal
,Binary
formatting (C-NUM-FMT)R: Read
andW: Write
by value (C-RW-VALUE)libopenexr-c-3_0.so
. It seems to be a rust bug. (Ticket: https://github.com/rust-lang/cargo/issues/8531)?
, nottry!
, notunwrap
(C-QUESTION-MARK)Deref
andDerefMut
(C-DEREF)bool
orOption
(C-CUSTOM-TYPE)bitflags
, not enums (C-BITFLAG)Debug
(C-DEBUG)Debug
representation is never empty (C-DEBUG-NONEMPTY)Testing Checklist
The tests are meant to validate that the wrappers are sound and work as expected. Tests that are designed to exercise code for the wrapped library and not the bindings should be added to the wrapped library instead.
unsafe {}
code is properly sanitized