Added an error for a corruption detection of the given bytes. This was
added so that an inproper CRC code when reading a PNG file could
throw an Error.
Added an error for an invalid value being transmuted from the given bytes.
This was added so that an Error can be thrown when a value outside of
a given range is parsed.
Conflicts:
Cargo.toml
src/converter.rs
src/transmutable.rs
Merged the code duplication removal from transmutable into the changes
made to handle the conversion in a safer fashion.
The previous code was relying on the to_be and to_le functions from the
standard library. These now rely on macros that I wrote to handle the
bit packing and unpacking. These were macros and not functions because
it is really hard to define the types and capabilities needed to
turn them into general functions. As such, the macros should never be
published publically and the Converters should be used for conversions.
The Transmutable property should be used for serialization and internally
the primitive types, Elements, all use the Converter functions and any
other objects should use the Transmutable primitives to build their
binary forms.
This library is relatively stable and has been gone over pretty well.
As such, it is now at version 1.0.0 and is considered ready for
public release (Use in the public space, not giving the code away).
An into_bytes function, which just called as_bytes, was decided as not
being needed because it would require that the Transmutable trait have
the requirement of being Sized. This may not be desirable in the future,
so for now there is no into_bytes. It can easily be added later with
a change to 9 lines of code.
The Sigils library will now only be compiled in and able to convert
math structures if the convert_sigils feature is selected.
use_std would have also been set as a feature, but the library heavily
uses std::collections::vec::Vec. Until a non-std version of a collection
has been written, then this needs to be used.
This was changed to make everything easier to use. The mutable buffers
were not working well for combined types. It was move to a growable array
to make these more advanced combined types, other structures, easier to
implement.
This added the ability to more easily print Vectors and Quaternions.
This also fixes some style issues.
Missing documents will now cause warnings when building.
A Vector can now be converted to and from bytes of data.
I'm not entirely sure that the structure bytes do not have to
be handled for endianess, but the underlying basic types are
correctly handled.
Tests and and example have also be created. The tests lib file was split
into a converter test file and a transmutable test file.
There is now a ByteSized trait that can be used to specify how many
bytes it takes to represent a piece of data. This has been implemented
for all of the primitive number types. With this information Transmutable
was able to create a Vector2 wrapper that will need to be tested. If it
works then soon after Vectors and other Sigils types can be turned into
Transmutable types.
This also has the changes for the original tests and example
to use the new ByteSized information.
There is now a random test for all the primitive number types.
Also, I fixed my errors with the tests that should panic. I kept thinking
that they should run fine and it was throwing off how I was writing
the code.
This tests buffer overflow for the basic types. It does not currently
test the platform int and uint until the final function definitions
are determined.
Numbers can be converted to and from bytes in both
BigEndian and LittleEndian styles. This does not yet take care of
the other mathematical structures provided by Sigil.
Also, no tests of these capabilities have been written yet.