Vendor asic-rs 0.8.1 (280 crates, offline builds) + wxWidgets 3.3.3 (pristine + patch queue); UI spec + ADR-0003; M1 on asic-rs

This commit is contained in:
2026-09-15 10:41:00 -06:00
parent 6dc77e8eb0
commit a2b65bb47f
16427 changed files with 6972976 additions and 3 deletions
+95
View File
@@ -0,0 +1,95 @@
//! Run this example with the following command in a terminal:
//!
//! ```console
//! $ echo -n 'example' | zstd | cargo run --example zstd_gzip --features="tokio,zstd,gzip" | gunzip -c
//! 7example
//! ```
//!
//! Note that the "7" prefix (input length) is printed to stdout but will likely show up as shown
//! above. This is not an encoding error; see the code in `main`.
use std::convert::TryFrom;
use std::io::Result;
use compression_codecs::lzma::params::{
LzmaDecoderParams, LzmaEncoderParams, LzmaFilter, LzmaFilters, LzmaOptions,
};
use tokio::io::{stdin, stdout, BufReader, Stdin, Stdout};
use tokio::io::{
AsyncReadExt as _, // for `read_to_end`
AsyncWriteExt as _, // for `write_all` and `shutdown`
};
const OPTIONS: &str = r"
Usage: lzma_filter [OPTIONS]
Read stdin and output result to stdout
Options:
-d Decompress (Default)
-c Compress
";
fn usage(msg: &str) -> Result<()> {
if !msg.is_empty() {
eprintln!("{msg}...")
}
eprintln!("{}", OPTIONS);
std::process::exit(1);
}
/// Read compressed and output decompressed or
/// Read decompressed and output compressed
/// echo "this is a test" | lzma_filters -- -c | lzma_filters -- -d | xxd
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let args: Vec<String> = std::env::args().collect();
if args.len() != 2 {
return usage("too many args");
}
let stdin = stdin();
let stdout = stdout();
let filters =
LzmaFilters::default().add_filter(LzmaFilter::Lzma2(LzmaOptions::default().preset(7)));
let mut stdout = if args[1] == "-d" {
decompress(stdin, filters, stdout).await?
} else if args[1] == "-c" {
compress(stdin, filters, stdout).await?
} else {
return usage(&format!("invalid argument: {}", args[1]));
};
stdout.flush().await?;
stdout.shutdown().await?;
Ok(())
}
async fn decompress(stdin: Stdin, filters: LzmaFilters, mut stdout: Stdout) -> Result<Stdout> {
let params = LzmaDecoderParams::Raw { filters };
let codec = compression_codecs::Xz2Decoder::try_from(params).expect("Could not create encoder");
let codec = compression_codecs::LzmaDecoder::from(codec);
let mut reader =
async_compression::tokio::bufread::LzmaDecoder::with_codec(BufReader::new(stdin), codec);
let mut buf = vec![];
reader.read_to_end(&mut buf).await?;
stdout.write_all(&buf).await?;
Ok(stdout)
}
async fn compress(mut stdin: Stdin, filters: LzmaFilters, stdout: Stdout) -> Result<Stdout> {
let params = LzmaEncoderParams::Raw { filters };
let codec = compression_codecs::Xz2Encoder::try_from(params).expect("Could not create encoder");
let codec = compression_codecs::LzmaEncoder::from(codec);
let mut writer = async_compression::tokio::write::LzmaEncoder::with_codec(stdout, codec);
let mut buf = vec![];
stdin.read_to_end(&mut buf).await?;
writer.write_all(&buf).await?;
writer.shutdown().await?;
Ok(writer.into_inner())
}
+35
View File
@@ -0,0 +1,35 @@
//! Run this example with the following command in a terminal:
//!
//! ```console
//! $ cargo run --example zlib_tokio_write --features="tokio,zlib"
//! "example"
//! ```
use std::io::Result;
use async_compression::tokio::write::{ZlibDecoder, ZlibEncoder};
use tokio::io::AsyncWriteExt as _; // for `write_all` and `shutdown`
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let data = b"example";
let compressed_data = compress(data).await?;
let de_compressed_data = decompress(&compressed_data).await?;
assert_eq!(de_compressed_data, data);
println!("{:?}", String::from_utf8(de_compressed_data).unwrap());
Ok(())
}
async fn compress(in_data: &[u8]) -> Result<Vec<u8>> {
let mut encoder = ZlibEncoder::new(Vec::new());
encoder.write_all(in_data).await?;
encoder.shutdown().await?;
Ok(encoder.into_inner())
}
async fn decompress(in_data: &[u8]) -> Result<Vec<u8>> {
let mut decoder = ZlibDecoder::new(Vec::new());
decoder.write_all(in_data).await?;
decoder.shutdown().await?;
Ok(decoder.into_inner())
}
+42
View File
@@ -0,0 +1,42 @@
//! Run this example with the following command in a terminal:
//!
//! ```console
//! $ echo -n 'example' | zstd | cargo run --example zstd_gzip --features="tokio,zstd,gzip" | gunzip -c
//! 7example
//! ```
//!
//! Note that the "7" prefix (input length) is printed to stdout but will likely show up as shown
//! above. This is not an encoding error; see the code in `main`.
use std::io::Result;
use async_compression::tokio::{bufread::ZstdDecoder, write::GzipEncoder};
use tokio::io::{stderr, stdin, stdout, BufReader};
use tokio::io::{
AsyncReadExt as _, // for `read_to_end`
AsyncWriteExt as _, // for `write_all` and `shutdown`
};
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
// Read zstd encoded data from stdin and decode
let mut reader = ZstdDecoder::new(BufReader::new(stdin()));
let mut x: Vec<u8> = vec![];
reader.read_to_end(&mut x).await?;
// print to stderr the length of the decoded data
let mut error = stderr();
error.write_all(x.len().to_string().as_bytes()).await?;
error.shutdown().await?;
// print to stdin encoded gzip data
let mut writer = GzipEncoder::new(stdout());
writer.write_all(&x).await?;
writer.shutdown().await?;
// flush stdout
let mut res = writer.into_inner();
res.flush().await?;
Ok(())
}