(scope: StorageScope, key: &str)
| 20 | } |
| 21 | |
| 22 | pub fn load_string(scope: StorageScope, key: &str) -> io::Result<Option<String>> { |
| 23 | let Some(bytes) = load_bytes(scope, key)? else { |
| 24 | return Ok(None); |
| 25 | }; |
| 26 | let text = |
| 27 | String::from_utf8(bytes).map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?; |
| 28 | Ok(Some(text)) |
| 29 | } |
| 30 | |
| 31 | pub fn save_string(scope: StorageScope, key: &str, text: &str) -> io::Result<()> { |
| 32 | save_bytes(scope, key, text.as_bytes()) |
no test coverage detected