Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clucompany/clulamansh
A binary record of the values stored in the array using the Lamansh protocol.
https://github.com/clucompany/clulamansh
clucompany clulamansh lamansh lamash-protocol protocol
Last synced: 2 months ago
JSON representation
A binary record of the values stored in the array using the Lamansh protocol.
- Host: GitHub
- URL: https://github.com/clucompany/clulamansh
- Owner: clucompany
- License: apache-2.0
- Created: 2018-07-29T00:01:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-23T17:20:25.000Z (over 5 years ago)
- Last Synced: 2024-10-31T11:35:08.074Z (3 months ago)
- Topics: clucompany, clulamansh, lamansh, lamash-protocol, protocol
- Language: Rust
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cluLamansh
[![Build Status](https://travis-ci.org/clucompany/cluLamansh.svg?branch=master)](https://travis-ci.org/clucompany/cluLamansh)
[![Apache licensed](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)
[![crates.io](http://meritbadge.herokuapp.com/cluLamansh)](https://crates.io/crates/cluLamansh)
[![Documentation](https://docs.rs/cluLamansh/badge.svg)](https://docs.rs/cluLamansh)A binary record of the values stored in the array using the Lamansh protocol.
# Protocol Lamansh
```rust
let lamansh = new_custom_lamansh::( // PROTOCOL SIZED U8 - 255 elements, U64 - 64 sized value len
&[/* 2 bin value, [1, 1, 1,] and [23, 55] */1u8, /* count len_header, 8 bit */
0u8,0u8,0u8,0u8,0u8,0u8,0u8,3u8, /* count len value, 64 bit */
0u8,0u8,0u8,0u8,0u8,0u8,0u8,2u8,1u8,1u8,1u8, /* value, max 64 bit value */
23u8,55u8]
).unwrap();
```# Use
```rust
extern crate cluLamansh;use cluLamansh::new_custom_lamansh;
use cluLamansh::lamansh::build::ToLamansh;
use cluLamansh::lamansh::sized::U64;
use cluLamansh::lamansh::sized::U8;type CountElements = U8;
type ValueLenElements = U64;pub fn main() {
let array = &[
&b"TEST"[..],
&b""[..],
&b"my_test"[..],
].to_lamansh::().unwrap();let lamash = new_custom_lamansh::(array).unwrap();
let mut iter = lamash.iter();
assert_eq!(iter.next(), Some( Result::Ok( &b"TEST"[..] ) ));
assert_eq!(iter.next(), Some( Result::Ok( &b""[..] ) ));
assert_eq!(iter.next(), Some( Result::Ok( &b"my_test"[..] ) ));assert_eq!(iter.next(), None);
}
```# Use Buffer
Eliminates buffer redistribution.```rust
extern crate cluLamansh;use cluLamansh::new_custom_lamansh;
use cluLamansh::lamansh::build::ToLamansh;
use cluLamansh::lamansh::sized::U64;
use cluLamansh::lamansh::sized::U8;
use cluLamansh::lamansh::buffer::LamanshBuffer;type CountElements = U8;
type ValueLenElements = U64;pub fn main() {
let mut buffer = LamanshBuffer::new();for a in 99 .. 120 {
let string_a = a.to_string();&[
&b"TEST"[..],
&b"TEST45"[..],
&b"TEST2"[..],
&b"TEST3"[..],
&b""[..],
string_a.as_bytes(),
].update_buffer::(&mut buffer).unwrap();let lamash = new_custom_lamansh::(&mut buffer).unwrap();
let mut iter = lamash.iter();
assert_eq!(iter.next(), Some( Result::Ok( &b"TEST"[..] ) ));
assert_eq!(iter.next(), Some( Result::Ok( &b"TEST45"[..] ) ));
assert_eq!(iter.next(), Some( Result::Ok( &b"TEST2"[..] ) ));
assert_eq!(iter.next(), Some( Result::Ok( &b"TEST3"[..] ) ));
assert_eq!(iter.next(), Some( Result::Ok( &b""[..] ) ));
assert_eq!(iter.next(), Some( Result::Ok( string_a.as_bytes() ) ));assert_eq!(iter.next(), None);
}}
```# License
Copyright 2018 #UlinProject Денис Котляров
Licensed under the Apache License, Version 2.0