Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API Reference

This page lists the public types and their key methods across all crates. For full documentation with examples, generate rustdoc:

cargo doc --workspace --no-deps --open

Or for a specific crate:

cargo doc --package acls-rs --open
cargo doc --package hbac-rs --open
cargo doc --package abac-rs --open
cargo doc --package perf-testing --open

acls-rs

Algebraic access control: permissions, subjects, roles, attributes, and temporal rules.

acls_rs::permission

Core permission types.

TypeDescription
AtomicPermissionSingle namespace:action permission. new(ns, action), FromStr, Display.
PermissionSetSet of atomic permissions. from([...]), combine() (union), meet() (intersection), join() (join), difference(). Operators: |, &, -.
GrantDenialPairGrants + denials with denial precedence. new(grants, denials), empty(), has_permission(), effective_permissions().
PermissionDeltaBatch permission change. builder().grant_str(ns, act).remove_str(ns, act).build(), apply_to(set).
TemporalPermissionTime-windowed permission. new(perm, from, until), is_valid_at(ts), is_currently_valid().
TemporalPermissionSetCollection of temporal permissions. new(), add(), effective_at(ts), currently_effective().
DenialSetSet of denied permissions.
TimestampType alias for u64 (milliseconds since epoch).
current_timestamp_millis()Returns the current time as a Timestamp.

See Permissions and Subjects, Temporal Permissions.

acls_rs::subject

TypeDescription
SubjectUser or service account. new(id), builder().id(id).grant(perm).role(r).build().unwrap(), has_permission(), grant(), deny(), effective_permissions_at(ts). Fields: id, roles, temporal_permissions.
BuilderErrorError from Subject::builder().build().

acls_rs::resource

TypeDescription
ResourceProtected object. new(name).requires(perm).resource_type(t), can_access(&subject), missing_permissions(&subject).

acls_rs::policy

TypeDescription
RbacPolicyRole-based policy. new(), add_role(), resolve_permissions(&roles), effective_permissions(&roles).
RoleNamed permission bundle. new(name, GrantDenialPair), with_parent(name). Field: parent_roles.
RbacErrorError enum. Variant: CyclicDependency.
AbacPolicyAttribute-based policy. new() (MeetResolver default), with_resolver(resolver), add_rule(), evaluate(&context).
AttributeRuleAttribute-based rule. new().grant(perm, attrs).deny(perm, attrs).
AttributeContextType alias for HashMap<String, String>.
AttributePermissionResult of ABAC evaluation. has_permission(), effective_permissions().
MeetResolverConflict resolver: most restrictive wins (default).
JoinResolverConflict resolver: most permissive wins.
PriorityResolverConflict resolver: priority-ordered.
ConflictResolverTrait for custom resolvers.

See RBAC Policies, ABAC Policies.

acls_rs::algebra

Algebraic traits implemented by permission types.

TraitDescription
SemigroupAssociative binary operation.
MonoidSemigroup with identity element.
MeetSemilatticeGreatest lower bound (intersection).
JoinSemilatticeLeast upper bound (union).
LatticeBoth meet and join semilattice.
MonoidActionMonoidal action on another type.

acls_rs::calculation

Permission computation utilities.

TypeDescription
HasPermissionsTrait for types that carry permissions.
PermissionEffectResult of a permission check with rationale.
PermissionEffectBuilderBuilder for PermissionEffect.
PermissionPreviewPreview what permissions would result from a change.

acls_rs::prelude

Re-exports all commonly used types from the modules above. Use use acls_rs::prelude::*; in application code.


hbac-rs

Host-Based Access Control for FreeIPA environments. Built on acls-rs.

hbac_rs::rule

TypeDescription
HbacRuleThree-dimensional access rule. new(name), new_deny(name), enable(), disable(), set_user_category_all(), set_host_category_all(), set_service_category_all(), add_user(s), add_user_group(s), add_host(s), add_host_group(s), add_service(s), add_service_group(s), estimated_size(). All add_* methods accept impl Into<String> and return Result<(), CategoryError>. Fields: name: Arc<str>, enabled, users, targethosts, services, rule_type.
HbacRuleTypeEnum: Allow, Deny.

hbac_rs::category

TypeDescription
HbacCategoryEnum: All or Specific { names: Box<[Arc<str>]>, groups: Box<[Arc<str>]> }. new_specific(), all(), from_names_and_groups(names, groups), add_name(s), add_group(s), is_all(), estimated_heap_size().
CategoryErrorError when adding entities to a Category::All. Variant: CannotModifyAll.

hbac_rs::request

TypeDescription
HbacRequestAccess request. new(subject, host, service), builder(). Fields: user, targethost, targethost_groups, service, service_groups.
HbacRequestBuilderBuilder: user(), targethost(), targethost_group(), service(), service_group(), build() -> Result<HbacRequest, BuilderError>.
BuilderErrorError for missing required fields. Variant: MissingField(&str).

hbac_rs::policy

TypeDescription
HbacPolicyThread-safe policy (Mutex-backed). Type alias for HbacPolicyCore<Mutex<RulePipeline>>.
HbacPolicyLocalSingle-threaded policy (RefCell-backed). Type alias for HbacPolicyCore<RefCell<RulePipeline>>.
HbacPolicyCore<L>Generic policy. new(), add_rule(), add_temporal_rule(), remove_rule(), enable_rule(), disable_rule(), load_rules(), rules(), stats(), evaluate(), evaluate_detailed(), evaluate_at(), evaluate_detailed_at(), check_access(), evaluate_and_apply(), evaluate_and_apply_at(). With jit feature: enable_jit(), jit_compile_hot(), jit_stats().
HbacEvaluationResultResult of evaluation. is_allowed(), is_denied(). Fields: allowed, matched_rules, not_matched_rules.
PipelineLockTrait for thread-safety abstraction.

See Policy Evaluation.

hbac_rs::resource

TypeDescription
HbacResource(host, service) as an acls-rs Resource. new(host, service), builder(), can_access(&subject), missing_permissions(&subject), required_permission(), grant_access(&mut subject), deny_access(&mut subject).
HbacResourceBuilderBuilder: host(), service(), host_group(), service_group(), build().

hbac_rs::temporal

TypeDescription
TemporalHbacRuleTime-windowed HBAC rule. new(rule, from, until), valid_for_duration(rule, ms), valid_from(rule, ts), valid_until(rule, ts), is_valid_at(ts), is_currently_valid(), current_rule(), rule_at(ts). Fields: rule, valid_from, valid_until.

See Temporal HBAC Rules.

hbac_rs::compiled

TypeDescription
HbacCompiledEvaluatorPre-compiled HBAC evaluator with AHashSet-based lookups. build(rules), evaluate(request) -> bool. Separates deny and allow rules at build time. Detects universal allow for fast-path evaluation.

hbac_rs::composition

TypeDescription
ComposedPolicyHBAC+RBAC composition. new(hbac, rbac, mode), evaluate(), check_access(), hbac_policy(), hbac_policy_mut(), rbac_policy(), rbac_policy_mut().
CompositionModeEnum: And, Or, HbacFirst, RbacFirst.

See Policy Composition.

hbac_rs::cache

Caching pipeline for production deployments.

TypeDescription
RulePipelineSource-filter-cache-evaluate pipeline. builder(), load(), refresh(), incremental_update(), evaluate(), evaluate_with_tracking(), rule_count(), stats(), last_update_timestamp().
RulePipelineBuilderBuilder: with_source(), with_filter(), with_cache(), build().
RuleSourceTrait: fetch_all(), fetch_updated_since(), is_available().
RuleSourceErrorError enum: ConnectionFailed, AuthenticationFailed, ParseError, Unavailable, Other.
MemorySourceIn-memory source. new(rules), add_rule().
CompositeSourceMulti-source with fallback. new(), with_source(), add_source().
RuleFilterTrait: should_cache(), filter(), filter_cloned().
HostFilterHost-specific filter. for_host(name), with_group(), with_groups().
ApplicabilityFilterScope filter. global_only(), all_enabled().
AcceptAllFilterNo-op filter.
AndFilterLogical AND of filters. new(), with().
OrFilterLogical OR of filters. new(), with().
RuleCacheTrait: store(), get(), get_all(), get_many(), contains(), len(), is_empty(), clear(), stats().
IndexedCacheIn-memory indexed cache. new(), find_by_user(), find_by_host(), find_by_user_and_host().
DiskCachePersistent cache (requires serde). new(path), flush().
CacheStatsCache metrics. hit_rate(). Fields: rule_count, memory_bytes, hit_count, miss_count.
RuleIndexTrait: index(), find_by_user(), find_by_host(), find_by_service(), clear().
UserIndexIndex by user. new().
HostIndexIndex by host. new().
CompositeIndexMulti-dimensional index. new(), find_by_user_and_host().
BloomFilterCacheProbabilistic filter. build(rules), might_match(...).
DecisionNodeCompiled decision tree. build(rules), evaluate(request).

See Caching System, Caching Architecture.

hbac_rs::prelude

Re-exports commonly used types: HbacRule, HbacRuleType, HbacPolicy, HbacPolicyLocal, HbacRequest, HbacRequestBuilder, HbacResource, HbacResourceBuilder, HbacCategory, HbacEvaluationResult, ComposedPolicy, CompositionMode, TemporalHbacRule, plus acls-rs types (Subject, Resource, AtomicPermission, Timestamp, current_timestamp_millis).

Cache types are not in the prelude. Import them from hbac_rs::cache::*.


abac-rs

Attribute-Based Access Control with multi-type attributes and pluggable matchers. Built on acls-rs.

abac_rs::rule

TypeDescription
AbacRuleAttribute-based access rule. new(name), new_deny(name), enable(), disable(), add_condition(key, value), estimated_size(). Fields: name: Arc<str>, enabled, conditions, rule_type.
AbacRuleTypeEnum: Allow, Deny.

abac_rs::attribute

TypeDescription
AttributeValueMulti-type attribute value. Enum variants: String(String), Integer(i64), Float(f64), IpAddr(IpAddr), IpCidr(IpCidr), Custom(Box<dyn Any + Send + Sync>).
AttributeMatcherTrait for custom matching logic. matches(&self, value: &AttributeValue) -> bool.

abac_rs::request

TypeDescription
AbacRequestEvaluation request with attributes. new(), set_attribute(key, value), get_attribute(key). Field: attributes: HashMap<String, AttributeValue>.

abac_rs::policy

TypeDescription
AbacPolicyThread-safe policy (Mutex-backed). Type alias for AbacPolicyCore<Mutex<RulePipeline>>.
AbacPolicyLocalSingle-threaded policy (RefCell-backed). Type alias for AbacPolicyCore<RefCell<RulePipeline>>.
AbacPolicyCore<L>Generic policy. new(), add_rule(), add_temporal_rule(), remove_rule(), enable_rule(), disable_rule(), load_rules(), rules(), stats(), evaluate(), evaluate_detailed(), evaluate_at(), evaluate_detailed_at(), register_matcher(key, matcher).
AbacEvaluationResultResult of evaluation. is_allowed(), is_denied(). Fields: allowed, matched_rules, not_matched_rules.

See Policy Evaluation.

abac_rs::compiled

TypeDescription
AbacCompiledEvaluatorPre-compiled evaluator with extracted attributes. build(rules), evaluate(request).

abac_rs::temporal

TypeDescription
TemporalAbacRuleTime-windowed ABAC rule. new(rule, valid_from, valid_until), is_valid_at(ts).

abac_rs::cache

TypeDescription
RulePipelineEvaluation pipeline with deny index and compiled evaluator. evaluate(request), rebuild_indexes().
DenyIndexBitmap-based deny rule index (3.2x less memory than HBAC). build(rules), check_deny(request).
BloomFilterCacheProbabilistic filter for attributes. build(rules), might_match(...).

See ABAC User Guide.

abac_rs::prelude

Re-exports commonly used types: AbacRule, AbacRuleType, AbacPolicy, AbacPolicyLocal, AbacRequest, AbacEvaluationResult, AttributeValue, AttributeMatcher, TemporalAbacRule, plus acls-rs types (Subject, Timestamp, current_timestamp_millis).


abac-wasm

WebAssembly bindings for the ABAC engine. Provides a JSON-based API for managing and evaluating ABAC policies in browser and Node.js environments. All errors are returned as structured objects with {type, message} fields.

AbacPolicyWasm

MethodDescription
new()Create a new ABAC policy.
addRuleFromJson(json)Add a rule from a JSON string.
evaluateJson(requestJson)Evaluate a request; returns {"allowed": bool}.
loadRulesFromJson(jsonArray)Load multiple rules from a JSON array.
clearRules()Remove all rules from the policy.
getCacheStats()Return cache statistics as JSON.
getRuleCount()Return the number of loaded rules.
getAllRulesJson()Return all rules as a JSON array.
registerMatcher(dimension, matchFn)Register a custom JavaScript matcher function for a dimension. The callback receives (ruleValue, requestValue, requestGroups) and returns a boolean.

AbacRuleBuilderWasm

Fluent API for building ABAC rules without manual JSON construction.

MethodDescription
new(name)Create a builder with the given rule name.
addDimension(dimension, valuesJson)Add a dimension with typed attribute values.
addDimensionAll(dimension)Set a dimension to match all values (wildcard).
setEnabled(enabled)Enable or disable the rule (disabled by default).
setRuleType(type)Set "Allow" or "Deny".
buildJson()Return the rule as a JSON string for addRuleFromJson().

Error types

All methods that return errors produce a JavaScript object:

FieldValues
type"PolicyError", "JsonError", or "ValidationError"
messageHuman-readable description

hbac-wasm

WebAssembly bindings for the HBAC engine. Provides a JSON-based API for FreeIPA-style host-based access control in browser and Node.js environments.

HbacPolicyWasm

MethodDescription
new()Create a new HBAC policy.
addRuleFromJson(json)Add a rule from a JSON string.
checkAccessJson(requestJson)Evaluate a request; returns boolean.
evaluateDetailedJson(requestJson)Evaluate with detail; returns {allowed, matched_rules, not_matched_rules}.
loadRulesFromJson(jsonArray)Load multiple rules from a JSON array.
clearRules()Remove all rules from the policy.
getRuleCount()Return the number of loaded rules.

HbacRuleBuilderWasm

Fluent API for building HBAC rules.

MethodDescription
new(name)Create a builder with the given rule name.
userCategoryAll()Match all users.
hostCategoryAll()Match all hosts.
serviceCategoryAll()Match all services.
addUsers(json)Add specific users from JSON array.
addUserGroups(json)Add user groups from JSON array.
addHosts(json)Add specific hosts from JSON array.
addHostGroups(json)Add host groups from JSON array.
addServices(json)Add specific services from JSON array.
addServiceGroups(json)Add service groups from JSON array.
setEnabled(enabled)Enable or disable the rule.
setDeny()Set as a deny rule (allow by default).
buildJson()Return the rule as a JSON string for addRuleFromJson().

HbacRequestWasm

MethodDescription
new(user, targethost, service)Create a new request.
addUserGroups(json)Add user groups from JSON array.
addTargethostGroups(json)Add target host groups from JSON array.
addServiceGroups(json)Add service groups from JSON array.
toJson()Serialize to JSON string.
fromJson(json)(static) Deserialize from JSON string.

Error types

Same structured error format as abac-wasm: {type, message} objects with "PolicyError", "JsonError", or "ValidationError" types.


perf-testing

Performance testing framework and bac-perf CLI.

Key modules

ModuleDescription
perf_testing::synthesisRule generation with distribution presets and patterns.
perf_testing::fixturesFixture loading, saving, and validation (gzip-compressed JSON).
perf_testing::runnerBenchmark scenario execution and metrics collection.
perf_testing::bacBAC abstraction layer (BacPolicy trait, HbacPolicyAdapter).
perf_testing::clibac-perf command implementations.

See Performance Testing Framework, CLI Reference.