Skip to content

Commit a572ca4

Browse files
committed
metadata: mark public types as non_exhaustive
We want to be able to add new public fields/variants to the types without introducing breaking changes in the future.
1 parent f170744 commit a572ca4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scylla/src/cluster/metadata.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ impl Peer {
183183
}
184184
}
185185

186+
/// Describes a keyspace in the cluster.
186187
#[derive(Clone, Debug, PartialEq, Eq)]
188+
#[non_exhaustive]
187189
pub struct Keyspace {
188190
pub strategy: Strategy,
189191
/// Empty HashMap may as well mean that the client disabled schema fetching in SessionConfig
@@ -194,7 +196,9 @@ pub struct Keyspace {
194196
pub user_defined_types: HashMap<String, Arc<UserDefinedType<'static>>>,
195197
}
196198

199+
/// Describes a table in the cluster.
197200
#[derive(Clone, Debug, PartialEq, Eq)]
201+
#[non_exhaustive]
198202
pub struct Table {
199203
pub columns: HashMap<String, Column>,
200204
/// Names of the column of partition key.
@@ -207,13 +211,17 @@ pub struct Table {
207211
pub(crate) pk_column_specs: Vec<ColumnSpec<'static>>,
208212
}
209213

214+
/// Describes a materialized view in the cluster.
210215
#[derive(Clone, Debug, PartialEq, Eq)]
216+
#[non_exhaustive]
211217
pub struct MaterializedView {
212218
pub view_metadata: Table,
213219
pub base_table_name: String,
214220
}
215221

222+
/// Describes a column of the table.
216223
#[derive(Clone, Debug, PartialEq, Eq)]
224+
#[non_exhaustive]
217225
pub struct Column {
218226
pub typ: ColumnType<'static>,
219227
pub kind: ColumnKind,
@@ -315,6 +323,7 @@ impl PreCollectionType {
315323
}
316324

317325
#[derive(Clone, Debug, PartialEq, Eq)]
326+
#[non_exhaustive]
318327
pub enum ColumnKind {
319328
Regular,
320329
Static,
@@ -341,6 +350,7 @@ impl std::str::FromStr for ColumnKind {
341350
}
342351

343352
#[derive(Clone, Debug, PartialEq, Eq)]
353+
#[non_exhaustive]
344354
#[allow(clippy::enum_variant_names)]
345355
pub enum Strategy {
346356
SimpleStrategy {

0 commit comments

Comments
 (0)