mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
17 lines
364 B
Rust
17 lines
364 B
Rust
//! Some storage utilities
|
|
|
|
use std::fs::File;
|
|
use std::io::{Error as IoError, Read};
|
|
|
|
pub trait CheckedStringRead {
|
|
fn get_string(&mut self) -> Result<String, IoError>;
|
|
}
|
|
|
|
impl CheckedStringRead for File {
|
|
fn get_string(&mut self) -> Result<String, IoError> {
|
|
let mut s = String::new();
|
|
self.read_to_string(&mut s)?;
|
|
Ok(s)
|
|
}
|
|
}
|