Skip to main content

douyin_cli/
lib.rs

1pub mod api;
2pub mod auth;
3pub mod cli;
4pub mod comments;
5pub mod cookie;
6pub mod crawler;
7mod fs_utils;
8pub mod insights;
9pub mod mcp;
10mod net;
11pub mod obscura;
12pub mod openapi;
13pub mod settings;
14pub mod stats;
15
16/// Shorthand for the ubiquitous `map_err(|error| error.to_string())`.
17pub(crate) fn err(error: impl std::fmt::Display) -> String {
18    error.to_string()
19}
20
21#[cfg(test)]
22pub(crate) mod test_support {
23    pub fn must<T, E: std::fmt::Debug>(result: Result<T, E>) -> T {
24        match result {
25            Ok(value) => value,
26            Err(error) => panic!("expected Ok, got Err({error:?})"),
27        }
28    }
29
30    pub fn present<T>(value: Option<T>) -> T {
31        match value {
32            Some(value) => value,
33            None => panic!("expected Some, got None"),
34        }
35    }
36}