re_types/components/
resolution.rs

1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs
2// Based on "crates/store/re_types/definitions/rerun/components/resolution.fbs".
3
4#![allow(unused_braces)]
5#![allow(unused_imports)]
6#![allow(unused_parens)]
7#![allow(clippy::allow_attributes)]
8#![allow(clippy::clone_on_copy)]
9#![allow(clippy::cloned_instead_of_copied)]
10#![allow(clippy::map_flatten)]
11#![allow(clippy::needless_question_mark)]
12#![allow(clippy::new_without_default)]
13#![allow(clippy::redundant_closure)]
14#![allow(clippy::too_many_arguments)]
15#![allow(clippy::too_many_lines)]
16#![allow(clippy::wildcard_imports)]
17
18use ::re_types_core::SerializationResult;
19use ::re_types_core::try_serialize_field;
20use ::re_types_core::{ComponentBatch as _, SerializedComponentBatch};
21use ::re_types_core::{ComponentDescriptor, ComponentType};
22use ::re_types_core::{DeserializationError, DeserializationResult};
23
24/// **Component**: Pixel resolution width & height, e.g. of a camera sensor.
25///
26/// Typically in integer units, but for some use cases floating point may be used.
27#[derive(Clone, Debug, Copy, PartialEq)]
28pub struct Resolution(pub crate::datatypes::Vec2D);
29
30impl ::re_types_core::WrapperComponent for Resolution {
31    type Datatype = crate::datatypes::Vec2D;
32
33    #[inline]
34    fn name() -> ComponentType {
35        "rerun.components.Resolution".into()
36    }
37
38    #[inline]
39    fn into_inner(self) -> Self::Datatype {
40        self.0
41    }
42}
43
44::re_types_core::macros::impl_into_cow!(Resolution);
45
46impl<T: Into<crate::datatypes::Vec2D>> From<T> for Resolution {
47    fn from(v: T) -> Self {
48        Self(v.into())
49    }
50}
51
52impl std::borrow::Borrow<crate::datatypes::Vec2D> for Resolution {
53    #[inline]
54    fn borrow(&self) -> &crate::datatypes::Vec2D {
55        &self.0
56    }
57}
58
59impl std::ops::Deref for Resolution {
60    type Target = crate::datatypes::Vec2D;
61
62    #[inline]
63    fn deref(&self) -> &crate::datatypes::Vec2D {
64        &self.0
65    }
66}
67
68impl std::ops::DerefMut for Resolution {
69    #[inline]
70    fn deref_mut(&mut self) -> &mut crate::datatypes::Vec2D {
71        &mut self.0
72    }
73}
74
75impl ::re_byte_size::SizeBytes for Resolution {
76    #[inline]
77    fn heap_size_bytes(&self) -> u64 {
78        self.0.heap_size_bytes()
79    }
80
81    #[inline]
82    fn is_pod() -> bool {
83        <crate::datatypes::Vec2D>::is_pod()
84    }
85}