mlt_core/frames/v01/property/
scalars.rs1use crate::v01::{
2 FsstStrEncoder, IntEncoder, PresenceStream, PropertyEncoder, ScalarEncoder, ScalarValueEncoder,
3 StrEncoder,
4};
5
6impl ScalarEncoder {
7 #[must_use]
8 pub fn str(presence: PresenceStream, string_lengths: IntEncoder) -> Self {
9 let enc = StrEncoder::Plain { string_lengths };
10 Self {
11 presence,
12 value: ScalarValueEncoder::String(enc),
13 }
14 }
15 #[must_use]
17 pub fn int(presence: PresenceStream, enc: IntEncoder) -> Self {
18 Self {
19 presence,
20 value: ScalarValueEncoder::Int(enc),
21 }
22 }
23 #[must_use]
25 pub fn str_fsst(
26 presence: PresenceStream,
27 symbol_lengths: IntEncoder,
28 dict_lengths: IntEncoder,
29 ) -> Self {
30 let enc = FsstStrEncoder {
31 symbol_lengths,
32 dict_lengths,
33 };
34 Self {
35 presence,
36 value: ScalarValueEncoder::String(StrEncoder::Fsst(enc)),
37 }
38 }
39 #[must_use]
41 pub fn bool(presence: PresenceStream) -> Self {
42 Self {
43 presence,
44 value: ScalarValueEncoder::Bool,
45 }
46 }
47 #[must_use]
49 pub fn float(presence: PresenceStream) -> Self {
50 Self {
51 presence,
52 value: ScalarValueEncoder::Float,
53 }
54 }
55}
56
57impl From<ScalarEncoder> for PropertyEncoder {
59 fn from(encoder: ScalarEncoder) -> Self {
60 Self::Scalar(encoder)
61 }
62}