Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider other Value primitive variants #4

Open
carllerche opened this issue May 7, 2021 · 5 comments
Open

Consider other Value primitive variants #4

carllerche opened this issue May 7, 2021 · 5 comments

Comments

@carllerche
Copy link
Member

carllerche commented May 7, 2021

There are most likely other primitive types that should be passed around explicitly.

Ideas include:

@KevinMGranger
Copy link

I would find special-casing &[u8] (and Vec<u8>) useful in the library I'm working on.

Another (more general) idea is to do something akin to #[serde(with = "module")], allowing a customized Valuable impl on a per-field basis.

@hawkw
Copy link
Member

hawkw commented Oct 13, 2021

tracing 0.1 supports f64s as typed values; if we're going to do a wholesale replacement of tracing's value system with valuable in tracing 0.2, we should probably add support for floats as primitive values.

@taiki-e
Copy link
Member

taiki-e commented Oct 14, 2021

we should probably add support for floats as primitive values.

I believe floats are already supported.

/// A Rust `f32` value
///
/// # Examples
///
/// ```
/// use valuable::Value;
///
/// let v = Value::F32(3.1415);
/// ```
F32(f32),
/// A Rust `f64` value
///
/// # Examples
///
/// ```
/// use valuable::Value;
///
/// let v = Value::F64(3.1415);
/// ```
F64(f64),

@hawkw
Copy link
Member

hawkw commented Oct 15, 2021

we should probably add support for floats as primitive values.

I believe floats are already supported.

/// A Rust `f32` value
///
/// # Examples
///
/// ```
/// use valuable::Value;
///
/// let v = Value::F32(3.1415);
/// ```
F32(f32),
/// A Rust `f64` value
///
/// # Examples
///
/// ```
/// use valuable::Value;
///
/// let v = Value::F64(3.1415);
/// ```
F64(f64),

whoops, it looks like i can't read! never mind!

@hawkw
Copy link
Member

hawkw commented Nov 22, 2021

I don't think this needs to be a blocker for 0.1; we can always add new primitives in backwards-compatible changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants