
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
This is a simple ABI singleton Trait helper crate. When you need a trait that only one implementation can exist, you can use this crate.
A lib crate define a trait that only one implementation exist, you can use it with out <T>
like code.
#[api_trait]
pub trait Cat {
fn eat(food: Food) -> usize;
}
/// Only one kind of cat, so no need to known type with `<T>`.
pub fn cat_eat(food: Food) -> usize {
//`CatImpl` is auto generated.
CatImpl::eat(food)
}
A crate implements the trait and use lib funcs.
struct BlackCat;
// There is only one black cat in the world.
#[api_impl]
impl Cat for BlackCat {
fn eat(food: Food) -> usize {
println!("black cat eat one");
food.count - 1
}
}
fn main() {
let food = Food { count: 3 };
println!("There are {} food", food.count);
let left = cat_eat(food);
println!("food left: {}", left);
}
See test_project
in this repo for examples.
Only C FFI func support, self
fields are not supported.
FAQs
Unknown package
We found that abi-singleton demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.