Download crates/forge_app/src/truncation/truncate_fetch.rs from SaylorTwift/forgecode: direct link, hf CLI and curl.
- Browser
- Download file 593 Bytes
-
https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_app/src/truncation/truncate_fetch.rs
- Command line
-
hf download hf://SaylorTwift/forgecode/crates/forge_app/src/truncation/truncate_fetch.rs
-
curl -L -o truncate_fetch.rs https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_app/src/truncation/truncate_fetch.rs
593 Bytes
| /// Represents the result of fetch content truncation | |
| pub struct TruncatedFetchOutput { | |
| pub content: String, | |
| } | |
| /// Truncates fetch content based on character limit | |
| pub fn truncate_fetch_content(content: &str, truncation_limit: usize) -> TruncatedFetchOutput { | |
| let original_length = content.len(); | |
| let is_truncated = original_length > truncation_limit; | |
| let truncated_content = if is_truncated { | |
| content.chars().take(truncation_limit).collect() | |
| } else { | |
| content.to_string() | |
| }; | |
| TruncatedFetchOutput { content: truncated_content } | |
| } | |