File tree 10 files changed +34
-14
lines changed
10 files changed +34
-14
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
4
4
5
5
## [ Unreleased]
6
6
7
+ ### Added
8
+
9
+ - Mark the following functions as ` const ` ([ #674 ] ):
10
+ - ` ClusterResourceApplyStrategy::delete_orphans `
11
+ - ` LdapAuthenticationProvider::default_port `
12
+ - ` LdapAuthenticationProvider::use_tls `
13
+ - ` ListenerSpec::default_publish_not_ready_addresses `
14
+ - ` OpaApiVersion::get_data_api `
15
+ - ` CpuQuantity::from_millis `
16
+ - ` CpuQuantity::as_milli_cpus `
17
+ - ` BinaryMultiple::exponential_scale_factor `
18
+ - ` BinaryMultiple::get_smallest `
19
+ - ` MemoryQuantity::from_gibi `
20
+ - ` MemoryQuantity::from_mebi `
21
+ - ` ClusterCondition::is_good `
22
+ - ` ClusterOperationsConditionBuilder::new `
23
+ - ` commons::pdb::default_pdb_enabled `
24
+
25
+ [ #674 ] : https://github.com/stackabletech/operator-rs/pull/674
26
+
7
27
### Changed
8
28
9
29
- Convert the format of the Vector configuration from TOML to YAML ([ #670 ] ).
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ impl ClusterResourceApplyStrategy {
149
149
}
150
150
151
151
/// Indicates if orphaned resources should be deleted depending on the strategy.
152
- fn delete_orphans ( & self ) -> bool {
152
+ const fn delete_orphans ( & self ) -> bool {
153
153
match self {
154
154
ClusterResourceApplyStrategy :: NoApply
155
155
| ClusterResourceApplyStrategy :: ReconciliationPaused => false ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ pub struct LdapAuthenticationProvider {
31
31
}
32
32
33
33
impl LdapAuthenticationProvider {
34
- pub fn default_port ( & self ) -> u16 {
34
+ pub const fn default_port ( & self ) -> u16 {
35
35
match self . tls {
36
36
None => 389 ,
37
37
Some ( _) => 636 ,
@@ -91,7 +91,7 @@ impl LdapAuthenticationProvider {
91
91
}
92
92
93
93
/// Whether TLS is configured
94
- pub fn use_tls ( & self ) -> bool {
94
+ pub const fn use_tls ( & self ) -> bool {
95
95
self . tls . is_some ( )
96
96
}
97
97
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ pub struct ListenerSpec {
96
96
}
97
97
98
98
impl ListenerSpec {
99
- fn default_publish_not_ready_addresses ( ) -> Option < bool > {
99
+ const fn default_publish_not_ready_addresses ( ) -> Option < bool > {
100
100
Some ( true )
101
101
}
102
102
}
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ pub enum OpaApiVersion {
66
66
67
67
impl OpaApiVersion {
68
68
/// Returns the OPA data API path for the selected version
69
- pub fn get_data_api ( & self ) -> & ' static str {
69
+ pub const fn get_data_api ( & self ) -> & ' static str {
70
70
match self {
71
71
Self :: V1 => "v1/data" ,
72
72
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ pub struct PdbConfig {
20
20
pub max_unavailable : Option < u16 > ,
21
21
}
22
22
23
- fn default_pdb_enabled ( ) -> bool {
23
+ const fn default_pdb_enabled ( ) -> bool {
24
24
true
25
25
}
26
26
Original file line number Diff line number Diff line change @@ -20,15 +20,15 @@ pub struct CpuQuantity {
20
20
}
21
21
22
22
impl CpuQuantity {
23
- pub fn from_millis ( millis : usize ) -> Self {
23
+ pub const fn from_millis ( millis : usize ) -> Self {
24
24
Self { millis }
25
25
}
26
26
27
27
pub fn as_cpu_count ( & self ) -> f32 {
28
28
self . millis as f32 / 1000.
29
29
}
30
30
31
- pub fn as_milli_cpus ( & self ) -> usize {
31
+ pub const fn as_milli_cpus ( & self ) -> usize {
32
32
self . millis
33
33
}
34
34
}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ impl BinaryMultiple {
42
42
43
43
/// The exponential scale factor used when converting a `BinaryMultiple`
44
44
/// to another one.
45
- fn exponential_scale_factor ( & self ) -> i32 {
45
+ const fn exponential_scale_factor ( & self ) -> i32 {
46
46
match self {
47
47
BinaryMultiple :: Kibi => 1 ,
48
48
BinaryMultiple :: Mebi => 2 ,
@@ -53,7 +53,7 @@ impl BinaryMultiple {
53
53
}
54
54
}
55
55
56
- pub fn get_smallest ( ) -> Self {
56
+ pub const fn get_smallest ( ) -> Self {
57
57
Self :: Kibi
58
58
}
59
59
}
@@ -160,14 +160,14 @@ pub struct MemoryQuantity {
160
160
}
161
161
162
162
impl MemoryQuantity {
163
- pub fn from_gibi ( gibi : f32 ) -> Self {
163
+ pub const fn from_gibi ( gibi : f32 ) -> Self {
164
164
Self {
165
165
value : gibi,
166
166
unit : BinaryMultiple :: Gibi ,
167
167
}
168
168
}
169
169
170
- pub fn from_mebi ( mebi : f32 ) -> Self {
170
+ pub const fn from_mebi ( mebi : f32 ) -> Self {
171
171
Self {
172
172
value : mebi,
173
173
unit : BinaryMultiple :: Mebi ,
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ impl std::fmt::Display for ClusterCondition {
145
145
impl ClusterCondition {
146
146
/// Returns if the [`ClusterCondition`] is considered to be in a good /
147
147
/// healthy state.
148
- pub fn is_good ( & self ) -> bool {
148
+ pub const fn is_good ( & self ) -> bool {
149
149
match self . type_ {
150
150
ClusterConditionType :: Available => match self . status {
151
151
ClusterConditionStatus :: False | ClusterConditionStatus :: Unknown => false ,
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ impl<'a> ConditionBuilder for ClusterOperationsConditionBuilder<'a> {
18
18
}
19
19
20
20
impl < ' a > ClusterOperationsConditionBuilder < ' a > {
21
- pub fn new ( cluster_operation : & ' a ClusterOperation ) -> Self {
21
+ pub const fn new ( cluster_operation : & ' a ClusterOperation ) -> Self {
22
22
Self { cluster_operation }
23
23
}
24
24
You can’t perform that action at this time.
0 commit comments