Repository navigation
fix!: Small things - #486
Merged
Merged
Conversation
…user can clone if needed
This is not used yet, but will be used for improving `SchemaAwareWriteSerializer`.
…ler source location when panicking
martin-g
approved these changes
Feb 26, 2026
Member
One note: |
Contributor
Author
|
We could change the implementation for option to this this: impl<T> AvroSchemaComponent for Option<T>
where
T: AvroSchemaComponent,
{
fn get_schema_in_ctxt(
named_schemas: &mut HashSet<Name>,
enclosing_namespace: &Namespace,
) -> Schema {
let schema = T::get_schema_in_ctxt(named_schemas, enclosing_namespace);
if let Schema::Null = schema {
Schema::Union(UnionSchema::new(vec![Schema::Null]).expect("This is a valid schema"))
} else {
let variants = vec![
Schema::Null,
schema,
];
Schema::Union(
UnionSchema::new(variants).expect("Option<T> must produce a valid (non-nested) union"),
)
}
}Then there is no error needed |
Member
|
Yep! This is also good! |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are a bunch of small fixes that don't really deserve their own PRs.
#[track_caller]forassert{,_not}_loggedto show the caller source location when panickingWrite::write_allinutils::encode_variableSER_BYTES_TYPEtoBytesType::Unsetand set if for every serialize/deserialize callSchemaAwareWriteSerializerthat will also add enum supportAvroSchemaComponentfor()Alias::nameandAlias::namespaceshould return references, user can clone if needed.clone()on the return value of the functionsdeserialize_big_decimaldoesn't need aVec<u8>SchemaAwareWriteSerializer