An open API service indexing awesome lists of open source software.

https://github.com/avi-d-coder/locked-resource

Allows you to pass a lock (StdinLock) with it's resource (Stdin).
https://github.com/avi-d-coder/locked-resource

Last synced: 9 months ago
JSON representation

Allows you to pass a lock (StdinLock) with it's resource (Stdin).

Awesome Lists containing this project

README

          

Allows you to pass a lock with it's resource.

```rust
use locked_resource::{LockedResource, WithLock};
use std::io::{stdin, BufRead, Stdin, StdinLock};

fn use_stdin<'l>(
mut locked_stdin: LockedResource>,
) -> LockedResource> {
let mut line = String::new();
locked_stdin.read_line(&mut line).unwrap();
locked_stdin
}

fn main() {
let mut locked_stdin = stdin().with_lock();

let mut line = String::new();
locked_stdin.read_line(&mut line).unwrap();
let locked_resource = use_stdin(locked_stdin);

let mut line = String::new();
locked_stdin.read_line(&mut line).unwrap();
}
```

### TODO
- Implement for Stdout
- Implement for Stderr
- etc..