Closed tiago-lqt closed 3 years ago
Yep was thinking From
On Tue, 20 Jul 2021 at 06:18, Tiago Carvalho @.***> wrote:
@.**** commented on this pull request.
In openexr-rs/src/core/preview_image.rs https://github.com/vfx-rs/openexr-bind/pull/41#discussion_r672526170:
- b: u8,
- /// The pixel's alpha.
- /// 0 == transparent, 255 == opaque.
- a: u8, +}
+impl PreviewRgba {
- /// Creates a
PreviewRgba
from RGB and Alphau8
values- ///
- pub fn from_u8(r: u8, g: u8, b: u8, a: u8) -> PreviewRgba {
- PreviewRgba { r, g, b, a }
- }
- /// Creates a
PreviewRgba
from RGB and Alphau8
values- ///
- pub fn from_f16(r: f16, g: f16, b: f16, a: f16) -> PreviewRgba {
What do you have in mind for the From? impl From
for PreviewRgba or something else? And should we still keep this function? — You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/vfx-rs/openexr-bind/pull/41#discussion_r672526170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOYQXK3MVO72E6QAXBLRV3TYRUBBANCNFSM5AO7DSLQ .
Description
Fixes #1.
Implements bindings for PreviewImage
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.
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)?
, 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