[−][src]Struct no_proto::NP_Packed_Buffer
Packed Buffer Container
Fields
schema: NP_Schema
Schema data for this packed buffer
Implementations
impl<'packed> NP_Packed_Buffer<'packed>
[src]
pub fn open(buffer: Vec<u8>) -> Result<Self, NP_Error>
[src]
Open a packed buffer
pub fn close_packed(self) -> Vec<u8>
[src]
Close this buffer and pack it
pub fn into_buffer(self) -> NP_Buffer<'packed>
[src]
Convert this packed buffer into a regular buffer
pub fn compile_schema(&self) -> &[u8]
[src]
Get the schema bytes for this packed buffer
Methods from Deref<Target = NP_Buffer<'packed>>
pub fn json_encode(&self, path: &[&str]) -> Result<NP_JSON, NP_Error>
[src]
Copy an object at the provided path and all it's children into JSON.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new(r#" struct({fields: { age: u8(), name: string() }}) "#)?; let mut new_buffer = factory.empty_buffer(None); new_buffer.set(&["name"], "Jeb Kermin"); new_buffer.set(&["age"], 30u8); assert_eq!(r#"{"value":{"age":30,"name":"Jeb Kermin"}}"#, new_buffer.json_encode(&[])?.stringify()); assert_eq!(r#"{"value":"Jeb Kermin"}"#, new_buffer.json_encode(&["name"])?.stringify());
pub fn read_bytes(&self) -> &[u8]
[src]
Read the bytes of the buffer immutably. No touching!
pub fn move_cursor(&mut self, path: &[&str]) -> Result<bool, NP_Error>
[src]
Move buffer cursor to new location. Cursors can only be moved into children. If you need to move up reset the cursor to root, then move back down to the desired level.
This also creates objects/collections along the path as needed. If you attempt to move into a path that doesn't exist, this method will return false
. Otherwise it will return true
of the path requested exists or is something that can be made to exist.
pub fn cursor_to_root(&mut self)
[src]
Moves cursor position to root of buffer, the default.
pub fn set_max(&mut self, path: &[&str]) -> Result<bool, NP_Error>
[src]
Set the max value allowed for the specific data type at the given key.
String & Byte types only work if a size
property is set in the schema.
Will return true
if a value was found and succesfully set, false
otherwise.
WARNING If you call this on a collection (Map, Tuple, List, or Table) ALL children will be overwritten/set. The method is recursive, so this will hit all children, including nested children.
When this is applied to a string
data type, only ascii values are supported.
use no_proto::error::NP_Error; use no_proto::NP_Factory; let factory: NP_Factory = NP_Factory::new(r#" tuple({ sorted: true, values: [string({size: 10}), u32()] }) "#)?; let mut low_buffer = factory.empty_buffer(None); // set all types to minimum value low_buffer.set_min(&[])?; // get bytes let low_bytes: Vec<u8> = low_buffer.close(); let mut high_buffer = factory.empty_buffer(None); // set all types to max value high_buffer.set_max(&[])?; // get bytes let high_bytes: Vec<u8> = high_buffer.close(); let mut middle_buffer = factory.empty_buffer(None); middle_buffer.set(&["0"], "Light This Candle!"); middle_buffer.set(&["1"], 22938u32); let middle_bytes: Vec<u8> = middle_buffer.close(); assert!(low_bytes < middle_bytes); assert!(middle_bytes < high_bytes); assert!(low_bytes < high_bytes);
pub fn set_min(&mut self, path: &[&str]) -> Result<bool, NP_Error>
[src]
Set the min value allowed for the specific data type at the given key.
String & Byte types only work if a size
property is set in the schema.
Will return true
if a value was found and succesfully set, false
otherwise.
WARNING If you call this on a collection (Map, Tuple, List, or Table) ALL children will be overwritten/set. The method is recursive, so this will hit all children, including nested children.
When this is applied to a string
data type, only ascii values are supported.
use no_proto::error::NP_Error; use no_proto::NP_Factory; let factory: NP_Factory = NP_Factory::new(r#" tuple({ sorted: true, values: [string({size: 10}), u32()] }) "#)?; let mut low_buffer = factory.empty_buffer(None); // set all types to minimum value low_buffer.set_min(&[])?; // get bytes let low_bytes: Vec<u8> = low_buffer.close(); let mut high_buffer = factory.empty_buffer(None); // set all types to max value high_buffer.set_max(&[])?; // get bytes let high_bytes: Vec<u8> = high_buffer.close(); let mut middle_buffer = factory.empty_buffer(None); middle_buffer.set(&["0"], "Light This Candle!"); middle_buffer.set(&["1"], 22938u32); let middle_bytes: Vec<u8> = middle_buffer.close(); assert!(low_bytes < middle_bytes); assert!(middle_bytes < high_bytes); assert!(low_bytes < high_bytes);
pub fn set<'set, X: 'set>(
&mut self,
path: &[&str],
value: X
) -> Result<bool, NP_Error> where
X: NP_Value<'set> + NP_Scalar<'set>,
[src]
&mut self,
path: &[&str],
value: X
) -> Result<bool, NP_Error> where
X: NP_Value<'set> + NP_Scalar<'set>,
Used to set scalar values inside the buffer.
The type that you set with will be compared to the schema, if it doesn't match the schema the request will fail.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; // a list where each item is a map where each key has a value containing a list of strings let factory: NP_Factory = NP_Factory::new(r#"list({of: map({value: list({of: string()})})})"#)?; let mut new_buffer = factory.empty_buffer(None); // third item in the top level list -> key "alpha" of map at 3rd element -> 9th element of list at "alpha" key // new_buffer.set(&["3", "alpha", "9"], "look at all this nesting madness")?; // get the same item we just set let message = new_buffer.get::<&str>(&["3", "alpha", "9"])?; assert_eq!(message, Some("look at all this nesting madness"));
pub fn set_with_json<S: Into<String>>(
&mut self,
path: &[&str],
json_value: S
) -> Result<bool, NP_Error>
[src]
&mut self,
path: &[&str],
json_value: S
) -> Result<bool, NP_Error>
Set value with JSON
This works with all types including portals.
Data that doesn't align with the schema will be ignored. Null
and undefined
values will be ignored.
Partial updates just merge the provided values into the buffer, you only need to provide the values you'd like changed. This method cannot be used to delete values.
Using the .set()
method is far more performant. I recommend only using this on the client side of your application.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new("list({of: string()})")?; let mut new_buffer = factory.empty_buffer(None); new_buffer.set_with_json(&[], r#"{"value": ["foo", "bar", null, "baz"]}"#)?; assert_eq!(new_buffer.length(&[])?, Some(4)); assert_eq!(new_buffer.get::<&str>(&["0"])?, Some("foo")); assert_eq!(new_buffer.get::<&str>(&["1"])?, Some("bar")); assert_eq!(new_buffer.get::<&str>(&["2"])?, None); assert_eq!(new_buffer.get::<&str>(&["3"])?, Some("baz")); new_buffer.set_with_json(&["2"], r#"{"value": "bazzy"}"#)?; assert_eq!(new_buffer.get::<&str>(&["2"])?, Some("bazzy"));
pub fn get_collection<'iter>(
&'iter self,
path: &'iter [&str]
) -> Result<Option<NP_Generic_Iterator<'iter>>, NP_Error>
[src]
&'iter self,
path: &'iter [&str]
) -> Result<Option<NP_Generic_Iterator<'iter>>, NP_Error>
Get an iterator for a collection
List Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new("list({of: string()})")?; let mut new_buffer = factory.empty_buffer(None); // set value at 1 index new_buffer.set(&["1"], "hello")?; // set value at 4 index new_buffer.set(&["4"], "world")?; // push value onto the end new_buffer.list_push(&[], "!")?; // get iterator of root (list item) new_buffer.get_collection(&[])?.unwrap().into_iter().for_each(|item| { match item.index { 0 => assert_eq!(item.get::<&str>().unwrap(), None), 1 => assert_eq!(item.get::<&str>().unwrap(), Some("hello")), 2 => assert_eq!(item.get::<&str>().unwrap(), None), 3 => assert_eq!(item.get::<&str>().unwrap(), None), 4 => assert_eq!(item.get::<&str>().unwrap(), Some("world")), 5 => assert_eq!(item.get::<&str>().unwrap(), Some("!")), _ => panic!() }; });
Struct Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "struct", "fields": [ ["age", {"type": "uint8"}], ["name", {"type": "string"}], ["job", {"type": "string"}], ["tags", {"type": "list", "of": {"type": "string"}}] ] }"#)?; let mut new_buffer = factory.empty_buffer(None); // set value of age new_buffer.set(&["age"], 20u8)?; // set value of name new_buffer.set(&["name"], "Bill Kerman")?; // push value onto tags list new_buffer.list_push(&["tags"], "rocket")?; // get iterator of root (table) new_buffer.get_collection(&[])?.unwrap().into_iter().for_each(|item| { match item.key { "name" => assert_eq!(item.get::<&str>().unwrap(), Some("Bill Kerman")), "age" => assert_eq!(item.get::<u8>().unwrap(), Some(20)), "job" => assert_eq!(item.get::<&str>().unwrap(), None), "tags" => { /* tags field is list, can't do anything with it here */ }, _ => { panic!() } }; }); // we can also loop through items of the tags list new_buffer.get_collection(&["tags"])?.unwrap().into_iter().for_each(|item| { assert_eq!(item.index, 0); assert_eq!(item.get::<&str>().unwrap(), Some("rocket")); });
Map Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "map", "value": {"type": "string"} }"#)?; let mut new_buffer = factory.empty_buffer(None); // set value of color key new_buffer.set(&["color"], "blue")?; // set value of sport key new_buffer.set(&["sport"], "soccor")?; // get iterator of root (map) new_buffer.get_collection(&[])?.unwrap().into_iter().for_each(|item| { match item.key { "color" => assert_eq!(item.get::<&str>().unwrap(), Some("blue")), "sport" => assert_eq!(item.get::<&str>().unwrap(), Some("soccor")), _ => panic!() } });
Tuple Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "tuple", "values": [ {"type": "string"}, {"type": "u8"}, {"type": "bool"} ] }"#)?; let mut new_buffer = factory.empty_buffer(None); // set value at 0 index new_buffer.set(&["0"], "hello")?; // set value at 2 index new_buffer.set(&["2"], false)?; // get iterator of root (tuple item) new_buffer.get_collection(&[])?.unwrap().into_iter().for_each(|item| { match item.index { 0 => assert_eq!(item.get::<&str>().unwrap(), Some("hello")), 1 => assert_eq!(item.get::<u8>().unwrap(), None), 2 => assert_eq!(item.get::<bool>().unwrap(), Some(false)), _ => panic!() }; });
pub fn list_push<X: 'buffer>(
&mut self,
path: &[&str],
value: X
) -> Result<Option<u16>, NP_Error> where
X: NP_Value<'buffer> + NP_Scalar<'buffer>,
[src]
&mut self,
path: &[&str],
value: X
) -> Result<Option<u16>, NP_Error> where
X: NP_Value<'buffer> + NP_Scalar<'buffer>,
Push a value onto the end of a list. The path provided must resolve to a list type, and the type being pushed must match the schema
This is the most efficient way to add values to a list type.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "list", "of": {"type": "string"} }"#)?; let mut new_buffer = factory.empty_buffer(None); new_buffer.set(&["3"], "launch")?; new_buffer.list_push(&[], "this")?; new_buffer.list_push(&[], "rocket")?; // get iterator of root (list item) new_buffer.get_collection(&[])?.unwrap().into_iter().for_each(|item| { match item.index { 0 => assert_eq!(item.get::<&str>().unwrap(), None), 1 => assert_eq!(item.get::<&str>().unwrap(), None), 2 => assert_eq!(item.get::<&str>().unwrap(), None), 3 => assert_eq!(item.get::<&str>().unwrap(), Some("launch")), 4 => assert_eq!(item.get::<&str>().unwrap(), Some("this")), 5 => assert_eq!(item.get::<&str>().unwrap(), Some("rocket")), _ => panic!() }; }); let mut new_buffer = factory.empty_buffer(None); new_buffer.list_push(&[], "launch")?; new_buffer.list_push(&[], "this")?; new_buffer.list_push(&[], "rocket")?; // get iterator of root (list item) new_buffer.get_collection(&[])?.unwrap().into_iter().for_each(|item| { match item.index { 0 => assert_eq!(item.get::<&str>().unwrap(), Some("launch")), 1 => assert_eq!(item.get::<&str>().unwrap(), Some("this")), 2 => assert_eq!(item.get::<&str>().unwrap(), Some("rocket")), _ => panic!() }; });
pub fn length(&self, path: &[&str]) -> Result<Option<usize>, NP_Error>
[src]
Get length of String, Bytes, Table, Tuple, List or Map Type
If the type found at the path provided does not support length operations, you'll get None
.
If there is no value at the path provodid, you will get None
.
If an item is found and it's length is zero, you can expect Some(0)
.
String Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "string" }"#)?; let mut new_buffer = factory.empty_buffer(None); // set initial value new_buffer.set(&[], "hello")?; // get length of value at root (String) assert_eq!(new_buffer.length(&[])?, Some(5));
Collection (List) Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "list", "of": {"type": "string"} }"#)?; let mut new_buffer = factory.empty_buffer(None); // set value at 9th index new_buffer.set(&["9"], "hello")?; // get length of value at root (List) assert_eq!(new_buffer.length(&[])?, Some(10));
Collection (Table) Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "struct", "fields": [ ["age", {"type": "u8"}], ["name", {"type": "string"}] ] }"#)?; let mut new_buffer = factory.empty_buffer(None); // get length of value at root (Table) assert_eq!(new_buffer.length(&[])?, Some(2));
Collection (Map) Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "map", "value": {"type": "string"} }"#)?; let mut new_buffer = factory.empty_buffer(None); // set values new_buffer.set(&["foo"], "bar")?; new_buffer.set(&["foo2"], "bar2")?; // get length of value at root (Map) assert_eq!(new_buffer.length(&[])?, Some(2));
Collection (Tuple) Example
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "tuple", "values": [ {"type": "string"}, {"type": "string"} ] }"#)?; let mut new_buffer = factory.empty_buffer(None); // get length of value at root (Tuple) assert_eq!(new_buffer.length(&[])?, Some(2));
pub fn del(&mut self, path: &[&str]) -> Result<bool, NP_Error>
[src]
Clear an inner value from the buffer. This can also be used to clear deeply nested collection objects or scalar objects.
Returns true
if it found a value to delete (and deleted it), false
otherwise.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "list", "of": {"type": "string"} }"#)?; let mut new_buffer = factory.empty_buffer(None); // set index 0 new_buffer.set(&["0"], "hello")?; // del index 0 new_buffer.del(&["0"])?; // value is gone now! assert_eq!(None, new_buffer.get::<&str>(&["0"])?);
pub fn get_schema_type(
&self,
path: &[&str]
) -> Result<Option<NP_TypeKeys>, NP_Error>
[src]
&self,
path: &[&str]
) -> Result<Option<NP_TypeKeys>, NP_Error>
Retrieve the schema type at a given path.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::schema::NP_TypeKeys; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "tuple", "values": [ {"type": "geo8"}, {"type": "dec", "exp": 2}, {"type": "string"} ] }"#)?; let mut new_buffer = factory.empty_buffer(None); assert_eq!(new_buffer.get_schema_type(&[])?.unwrap(), NP_TypeKeys::Tuple); assert_eq!(new_buffer.get_schema_type(&["0"])?.unwrap(), NP_TypeKeys::Geo); assert_eq!(new_buffer.get_schema_type(&["1"])?.unwrap(), NP_TypeKeys::Decimal); assert_eq!(new_buffer.get_schema_type(&["2"])?.unwrap(), NP_TypeKeys::UTF8String);
pub fn get_schema_default<'get, X: 'get>(
&'get self,
path: &[&str]
) -> Result<Option<X>, NP_Error> where
X: NP_Value<'get> + NP_Scalar<'get>,
[src]
&'get self,
path: &[&str]
) -> Result<Option<X>, NP_Error> where
X: NP_Value<'get> + NP_Scalar<'get>,
Retrieve the schema default at a given path.
This is useful for geo
and dec
data types where there is information about the value in the schema.
For example, when you create an NP_Geo
type to put into a geo
field, you must know the resolution (4/8/16). If you use this method you can get an empty NP_Geo
type that already has the correct resolution set based on the schema.
The type that you cast the request to will be compared to the schema, if it doesn't match the schema the request will fail.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::pointer::dec::NP_Dec; use no_proto::pointer::geo::NP_Geo; // a list where each item is a map where each key has a value containing a list of strings let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "tuple", "values": [ {"type": "geo8"}, {"type": "dec", "exp": 2} ] }"#)?; let mut new_buffer = factory.empty_buffer(None); // Get an empty NP_Geo type that has the correct resolution for the schema // let geo_default: NP_Geo = new_buffer.get_schema_default::<NP_Geo>(&["0"])?.unwrap(); assert_eq!(geo_default.size, 8); // geo is size 8 in schema // Get an empty NP_Dec type that has the correct exp for the schema // let dec_default: NP_Dec = new_buffer.get_schema_default::<NP_Dec>(&["1"])?.unwrap(); assert_eq!(dec_default.exp, 2); // exponent is 2 in schema
pub fn get<'get, X: 'get>(
&'get self,
path: &[&str]
) -> Result<Option<X>, NP_Error> where
X: NP_Value<'get> + NP_Scalar<'get>,
[src]
&'get self,
path: &[&str]
) -> Result<Option<X>, NP_Error> where
X: NP_Value<'get> + NP_Scalar<'get>,
Retrieve an inner value from the buffer.
The type that you cast the request to will be compared to the schema, if it doesn't match the schema the request will fail.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; // a list where each item is a map where each key has a value containing a list of strings let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "list", "of": {"type": "map", "value": { "type": "list", "of": {"type": "string"} }} }"#)?; let mut new_buffer = factory.empty_buffer(None); // third item in the top level list -> key "alpha" of map at 3rd element -> 9th element of list at "alpha" key // new_buffer.set(&["3", "alpha", "9"], "who would build a schema like this")?; // get the same item we just set let message = new_buffer.get::<&str>(&["3", "alpha", "9"])?; assert_eq!(message, Some("who would build a schema like this"));
pub fn maybe_compact<F>(
&mut self,
new_capacity: Option<u32>,
mut callback: F
) -> Result<(), NP_Error> where
F: FnMut(NP_Size_Data) -> bool,
[src]
&mut self,
new_capacity: Option<u32>,
mut callback: F
) -> Result<(), NP_Error> where
F: FnMut(NP_Size_Data) -> bool,
This performs a compaction if the closure provided as the second argument returns true
.
Compaction is a pretty expensive operation (requires full copy of the whole buffer) so should be done sparingly.
The closure is provided an argument that contains the original size of the buffer, how many bytes could be saved by compaction, and how large the new buffer would be after compaction. The closure should return true
to perform compaction, false
otherwise.
The first argument, new_capacity, is the capacity of the underlying Vec
WARNING Your cursor location will be reset to the root.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "string" }"#)?; let mut new_buffer = factory.empty_buffer(None); // set initial value new_buffer.set(&[], "hello")?; // using 9 bytes assert_eq!(NP_Size_Data { current_buffer: 11, after_compaction: 11, wasted_bytes: 0 }, new_buffer.calc_bytes()?); // update the value new_buffer.set(&[], "hello, world")?; // now using 25 bytes, with 7 bytes of wasted space assert_eq!(NP_Size_Data { current_buffer: 25, after_compaction: 18, wasted_bytes: 7 }, new_buffer.calc_bytes()?); // compact to save space new_buffer.maybe_compact(None, |compact_data| { // only compact if wasted bytes are greater than 5 if compact_data.wasted_bytes > 5 { true } else { false } })?; // back down to 18 bytes with no wasted bytes assert_eq!(NP_Size_Data { current_buffer: 18, after_compaction: 18, wasted_bytes: 0 }, new_buffer.calc_bytes()?);
pub fn compact<'compact>(
&mut self,
new_capacity: Option<u32>
) -> Result<(), NP_Error>
[src]
&mut self,
new_capacity: Option<u32>
) -> Result<(), NP_Error>
Compacts a buffer to remove an unused bytes or free space after a mutation. This is a pretty expensive operation (requires full copy of the whole buffer) so should be done sparingly.
The first argument, new_capacity, is the capacity of the underlying Vec
WARNING Your cursor location will be reset to the root.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "string" }"#)?; let mut new_buffer = factory.empty_buffer(None); // set initial value new_buffer.set(&[], "hello")?; // using 11 bytes assert_eq!(NP_Size_Data { current_buffer: 11, after_compaction: 11, wasted_bytes: 0 }, new_buffer.calc_bytes()?); // update the value new_buffer.set(&[], "hello, world")?; // now using 25 bytes, with 7 bytes of wasted bytes assert_eq!(NP_Size_Data { current_buffer: 25, after_compaction: 18, wasted_bytes: 7 }, new_buffer.calc_bytes()?); // compact to save space new_buffer.compact(None)?; // back down to 18 bytes with no wasted bytes assert_eq!(NP_Size_Data { current_buffer: 18, after_compaction: 18, wasted_bytes: 0 }, new_buffer.calc_bytes()?);
pub fn calc_bytes<'bytes>(&self) -> Result<NP_Size_Data, NP_Error>
[src]
Recursively measures how many bytes each element in the buffer is using. This will let you know how many bytes can be saved from a compaction.
use no_proto::error::NP_Error; use no_proto::NP_Factory; use no_proto::NP_Size_Data; let factory: NP_Factory = NP_Factory::new_json(r#"{ "type": "string" }"#)?; let mut new_buffer = factory.empty_buffer(None); new_buffer.set(&[], "hello")?; assert_eq!(NP_Size_Data { current_buffer: 11, after_compaction: 11, wasted_bytes: 0 }, new_buffer.calc_bytes()?);
Trait Implementations
impl<'packed> Deref for NP_Packed_Buffer<'packed>
[src]
type Target = NP_Buffer<'packed>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<'packed> DerefMut for NP_Packed_Buffer<'packed>
[src]
Auto Trait Implementations
impl<'packed> Send for NP_Packed_Buffer<'packed>
[src]
impl<'packed> !Sync for NP_Packed_Buffer<'packed>
[src]
impl<'packed> Unpin for NP_Packed_Buffer<'packed>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,