Skip to main content

sim_codec_classfile/
lib.rs

1//! Frozen scope contract for the bounded, lossless JVM classfile codec.
2//!
3//! Parsing is intentionally introduced only after the retained corpus and its
4//! independently authored expectations have been fixed.
5
6#![forbid(unsafe_code)]
7#![deny(missing_docs)]
8
9mod attribute;
10mod bytes;
11mod constant;
12mod encode;
13mod instruction;
14mod modified_utf8;
15mod opcode_generated;
16mod runtime;
17mod shell;
18
19pub use attribute::{
20    Annotation, AnnotationDefaultAttribute, AnnotationElement, AnnotationsAttribute,
21    AttributeError, AttributeErrorKind, AttributeOrigin, BootstrapMethod,
22    BootstrapMethodsAttribute, ByteAttribute, CodeAttribute, CodeException, ElementValue,
23    EnclosingMethodAttribute, IndexAttribute, IndexListAttribute, InnerClass,
24    InnerClassesAttribute, LineNumber, LineNumberTableAttribute, LocalVariable,
25    LocalVariableTarget, LocalVariablesAttribute, MAX_ANNOTATION_NESTING, MarkerAttribute,
26    MethodParameter, MethodParametersAttribute, ModuleAttribute, ModuleExport, ModuleProvide,
27    ModuleRequire, NestedAttribute, NestedAttributeOwner, ParameterAnnotationsAttribute,
28    RecordAttribute, RecordComponent, RecordComponentAttribute, StackMapFrame,
29    StackMapTableAttribute, TypeAnnotation, TypeAnnotationTarget, TypeAnnotationsAttribute,
30    TypePathEntry, VerificationType, standard_attribute_min_major,
31};
32pub use bytes::{ByteError, ByteErrorKind, ByteReader, ByteWriter};
33pub use constant::{
34    Constant, ConstantPool, ConstantPoolError, ConstantPoolErrorKind, ConstantSlot,
35};
36pub use encode::encode_instructions;
37pub use instruction::{
38    DecodedCode, ExceptionHandlerRange, Instruction, InstructionError, InstructionErrorKind,
39    InstructionId, InstructionOperand, LocatedInstruction, decode_instructions,
40    validate_exception_handlers,
41};
42pub use modified_utf8::{decode_modified_utf8, encode_modified_utf8};
43pub use opcode_generated::{OPCODES, Opcode, OpcodeMetadata};
44pub use runtime::{ClassfileCodec, ClassfileCodecLib, inspect_classfile};
45pub use shell::{
46    AttributeLocation, AttributeOwner, AttributeShell, ClassIndex, ClassShell, EditReport,
47    FieldShell, LayoutInvalidation, MethodShell, ShellBudget, ShellError, ShellErrorKind,
48    Utf8Index, ValidatedClassShell, ValidatedFieldShell, ValidatedMethodShell,
49};
50
51/// Machine-readable format bounds and reuse decisions.
52pub const SCOPE: &str = include_str!("../scope.toml");
53
54/// Independently authored expectations for every retained fixture.
55pub const FIXTURE_EXPECTATIONS: &str = include_str!("../fixtures/expectations.toml");
56
57/// Cookbook recipes embedded for runtime help and browse surfaces.
58pub static RECIPES: sim_cookbook::EmbeddedDir =
59    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
60
61#[cfg(test)]
62mod tests;