[][src]Enum schema_registry_converter::schema_registry::SubjectNameStrategy

pub enum SubjectNameStrategy {
    RecordNameStrategy(String),
    TopicNameStrategy(Stringbool),
    TopicRecordNameStrategy(StringString),
    RecordNameStrategyWithSchema(SuppliedSchema),
    TopicNameStrategyWithSchema(StringboolSuppliedSchema),
    TopicRecordNameStrategyWithSchema(StringSuppliedSchema),
}

Strategy similar to the one in the Java client. By default schema's needs to be backwards compatible. Historically the only available strategy was the TopicNameStrategy. This meant in practice that a topic could only have one type, or the restriction on backwards compatibility was to be abandoned. Using either of the two other strategies allows multiple types of schema on on topic, while still being able to keep the restriction on schema's being backwards compatible. Depending on the strategy, either the topic, whether the value is used as key, the fully qualified name (only for RecordNameStrategy), or the schema needs to be provided.



let mut encoder = Encoder::new(server_address().to_string());

let heartbeat_schema = SuppliedSchema::new(r#"{"type":"record","name":"Heartbeat","namespace":"nl.openweb.data","fields":[{"name":"beat","type":"long"}]}"#.into());
let strategy = SubjectNameStrategy::TopicRecordNameStrategyWithSchema("hb".into(), heartbeat_schema);
let bytes = encoder.encode(vec![("beat", Value::Long(3))], &strategy);
assert_eq!(bytes, Ok(vec![0, 0, 0, 0, 23, 6]))

Variants

RecordNameStrategy(String)TopicNameStrategy(Stringbool)TopicRecordNameStrategy(StringString)RecordNameStrategyWithSchema(SuppliedSchema)TopicNameStrategyWithSchema(StringboolSuppliedSchema)TopicRecordNameStrategyWithSchema(StringSuppliedSchema)

Trait Implementations

impl Clone for SubjectNameStrategy[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for SubjectNameStrategy[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self