Rustypipes
Current Version: 0.1.1 (12/01/2020) Developed by Christian Visintin
Rustypipes is a Rust library to implement Octopipes clients and servers.
or
[]
= "0.1.1"
The library documentation can be found at https://docs.rs/unix-named-pipe/0.1.1/rustypipes/
Client Implementation
Implementing an Octopipes Client is pretty much simple and requires only the following steps:
Initialize the client
let cap_pipe: String = String from;
let mut client: OctopipesClient = new;
Subscribe to the server
let my_groups: = vec!;
match client.subscribe
Wait for incoming messages
//Start client loop
if let Err = client.loop_start
//...
//In your main loop
loop
Send a message
let mydata: = vec!;
if let Err = client.send
Then, when you're done, unsubscribe from server and terminate the client
if let Err = client.unsubscribe
Server Implementation
Rustypipes is designed to achieve the implementation of an Octopipes Server in the easiest and simplest way possible, saving up time and line of codes to the final developer.
Initialize the Server
let cap_pipe: String = String from;
let client_folder: String = String from;
let mut server: OctopipesServer = new;
Start the CAP listener
the CAP listener will just start a thread which will listen on the CAP for new messages, once a new message is received this will be able to be retrieved with cap process functions as we'll see later.
if let Err = server.start_cap_listener
Server Main Loop
These two simple functions will handle for you all the tasks the server has to achieve. Try to call this functions often (about each 100ms or less).
loop
Terminate the server
if let Err = server.stop_server
//You could also just call, since drop trait is implemented and stop the server gracefully
//drop(server);
Changelog
0.1.1 (12/01/2020)
- Added missing error description for "Write failed"
License
MIT License
Copyright (c) 2019-2020 Christian Visintin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.