You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I'm unable to understand why we have Value::Union. I attempted to run this code:
use anyhow::Error;
use avrow::{Schema, Writer};
use std::str::FromStr;
fn main() -> Result<(), Error> {
let schema = Schema::from_str(r##"{
"type": "record",
"name": "LongList",
"aliases": ["LinkedLongs"],
"fields" : [
{"name": "value", "type": "long"},
{"name": "next", "type": ["null", "LongList"]}
]
}"##)?;
let mut writer = Writer::new(&schema, std::io::stdout())?;
let mut r = avrow::Record::new("LongList");
r.insert("value", 2i64);
r.insert("next", avrow::Value::Union(Box::new(avrow::Value::Null)));
let res = writer.write(avrow::Value::Record(r))?;
Ok(())
}
...and I got error Error: Value schema not found in union.
Then I tried this code (note line "XXX"):
use anyhow::Error;
use avrow::{Schema, Writer};
use std::str::FromStr;
fn main() -> Result<(), Error> {
let schema = Schema::from_str(r##"{
"type": "record",
"name": "LongList",
"aliases": ["LinkedLongs"],
"fields" : [
{"name": "value", "type": "long"},
{"name": "next", "type": ["null", "LongList"]}
]
}"##)?;
let mut writer = Writer::new(&schema, std::io::stdout())?;
let mut r = avrow::Record::new("LongList");
r.insert("value", 2i64);
r.insert("next", avrow::Value::Null); // XXX
let res = writer.write(avrow::Value::Record(r))?;
Ok(())
}
...and this time I got no error.
So, it seems from my experiments, that Value::Union is not used at all in avrow. Am I right?
I grepped avrow source code and now I even more sure that Value::Union is not used. All code samples I found was trivial, Value::Union is never constructed.
So, please, mark it as deprecated to make docs more clear
The text was updated successfully, but these errors were encountered:
Hi. I'm unable to understand why we have Value::Union. I attempted to run this code:
...and I got error
Error: Value schema not found in union
.Then I tried this code (note line "XXX"):
...and this time I got no error.
So, it seems from my experiments, that
Value::Union
is not used at all in avrow. Am I right?I grepped avrow source code and now I even more sure that
Value::Union
is not used. All code samples I found was trivial,Value::Union
is never constructed.So, please, mark it as deprecated to make docs more clear
The text was updated successfully, but these errors were encountered: