-
Notifications
You must be signed in to change notification settings - Fork 74
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
On-demand primitive value conversion and construction #56
Merged
Conversation
This file contains 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
- move value encoding/decoding logic to dicom-core - encoding::decode::primitive_value becomes core::value:deserialize - encoding::encode::primitive_value becomes core::value:serialize - move trait method DicomValueType::is_empty to trait HashLength - improve documentation of DicomValueType::cardinality - improve root-level documentation in core
- improved and extend to_str method to accommodate value type conversion
- new value::primitive module - move dicom_value! macro to lib root - new error type ConvertValueError - add variant to existing error types - narrow errors of result types from value::deserialize - improve documentation and behavior of dicom_value! - improve documentation of PrimitiveValue - impl From<Vec<u8>> for PrimitiveValue - impl From<&[u8]> for PrimitiveValue - impl Display for PrimitiveValue - add PrimitiveValue::to_str - add PrimitiveValue::to_bytes - required safe-transmute dependency for the binary slice to bytes conversion - add PrimitiveValue::to_date
- Prefer standard From::from conversions here
- use macros to implement them en masse - getters return Result<*, CastValueError> instead of Option<*> - [parser] update use of getter in test
- generic method over the return type, which must be an integer and be convertible from string - add InvalidValueReadError::NarrowConvert - add num-traits as dependency to core
- apply change to more methods - improve documentation
- to_multi_float32 - to_multi_float64
- add tests for to_multi_int and to_multi_float{32,64} - on to_multi_*, return empty vector on Empty variant
Enet4
changed the title
Deferred primitive value conversion
On-demand primitive value conversion and construction
Jul 4, 2020
4 tasks
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.
This PR extends the available public API for
PrimitiveValue
in such a way that makes it more usable. This is deemed necessary before making string preservation the default behavior of the stateful decoder (see #9).encoding::decode::primitive_value
becomescore::value:deserialize
encoding::encode::primitive_value
becomescore::value:serialize
dicom_value!
macroFrom
HasLength::is_empty
to_str
,to_bytes
,to_int
,to_multi_int
,to_float32
,to_multi_float32
,to_float64
,to_multi_float64
,to_date
,to_time
,to_datetime
.Display
forPrimitiveValue
chrono
crate in core