Giter Site home page Giter Site logo

s2s's People

Contributors

deecellar avatar der-teufel-programming avatar fabioarnold avatar iacore avatar iddev5 avatar ultra-code avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

s2s's Issues

Add serialization/deserialization hook support for structs/unions

Similarly to how std.fmt supports adding a format() function to a struct or union, s2s should support it for custom serialization/deserialization or for when a type isn't fully supported. This would help with unsupported types that can't easily be serialized due to recursiveness.

error on test

when i run test give me this error
s2s.zig:474:49: error: no field named 'little' in enum 'builtin.Endian' std.mem.writeInt(AlignedInt(T), &res, val, .little); ~^~~~~~ C:\zig\lib\std\builtin.zig:452:20: note: enum declared here pub const Endian = enum { ^~~~ s2s.zig:486:34: note: called from here return intToLittleEndianBytes(hasher.final()); ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ s2s.zig:189:47: note: called from here const type_hash = comptime computeTypeHash(T); ~~~~~~~~~~~~~~~^~~

Bug serializing and deserializing slices

    var known_at_runtime_zero: usize = 0;
    const hello = [_][]const u8{"hello"};
    //@compileLog(hello);
    // Compile Log Output:
    //@as([1][]const u8, .{ .{ 104, 101, 108, 108, 111 } })
    try testSerDesAlloc([1][]const u8, hello);

gives error trace

Test [3/3] test.ser/des... index 0 incorrect. expected { 104, 101, 108, 108, 111 }, found { 104, 101, 108, 108, 111 }
Test [3/3] test.ser/des... FAIL (TestExpectedEqual)
/firefox/home/.local/zig/zig-linux-x86_64-0.10.0-dev.4060+61aaef0b0/lib/std/testing.zig:301:13: 0x232c93 in expectEqualSlices__anon_2505 (test)
            return error.TestExpectedEqual;
            ^
/firefox/home/.local/zig/zig-linux-x86_64-0.10.0-dev.4060+61aaef0b0/lib/std/testing.zig:108:27: 0x232ed5 in expectEqual__anon_2504 (test)
        .Array => |array| try expectEqualSlices(array.child, &expected, &actual),
                          ^
./s2s.zig:804:5: 0x233085 in testSerDesAlloc__anon_2499 (test)
    try std.testing.expectEqual(value, deserialized);
    ^
./s2s.zig:859:5: 0x239bac in test.ser/des (test)
    try testSerDesAlloc([1][]const u8, hello);
    ^
2 passed; 0 skipped; 1 failed.
error: the following test command failed with exit code 1:
zig-cache/o/9169a8a11ae643506497cd13316a9a5d/test /firefox/home/.local/zig/zig-linux-x86_64-0.10.0-dev.4060+61aaef0b0/zig

But it can clearly be seen that the expected and found bytes are the same

And on a related issue these test cases also fails

    try testSerDesPtrContentEquality(*const [1][]const u8, hello[0..]);
    try testSerDesSliceContentEquality([]const []const u8, hello[known_at_runtime_zero..]);

A futher example

    const K = struct { value: u8 };
    const works = [_]K{.{ .value = 7 }};
    try testSerDesAlloc([1]K, works); //passes test which as expected

    //doesn't pass test ,I think the errors are related to the above
    var doesnt_works = works;
    try testSerDesAlloc(*[1]K, doesnt_works[0..]);
    try testSerDesAlloc([]K, doesnt_works[known_at_runtime_zero..]);

This is a reproducer of an error I am getting while using s2s in my project. I'm I misunderstanding how to use s2s or this is a genuine bug with slice ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.