yew_websocket/format.rs
1use anyhow::Error;
2
3/**
4 * Copyright (c) 2017 Denis Kolodin
5
6Permission is hereby granted, free of charge, to any
7person obtaining a copy of this software and associated
8documentation files (the "Software"), to deal in the
9Software without restriction, including without
10limitation the rights to use, copy, modify, merge,
11publish, distribute, sublicense, and/or sell copies of
12the Software, and to permit persons to whom the Software
13is furnished to do so, subject to the following
14conditions:
15
16The above copyright notice and this permission notice
17shall be included in all copies or substantial portions
18of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
21ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
22TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
24SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28DEALINGS IN THE SOFTWARE.
29 */
30
31/// A representation of a value which can be stored and restored as a text.
32///
33/// Some formats are binary only and can't be serialized to or deserialized
34/// from Text. Attempting to do so will return an Err(FormatError).
35pub type Text = Result<String, Error>;
36
37/// A representation of a value which can be stored and restored as a binary.
38pub type Binary = Result<Vec<u8>, Error>;