ristretto_classfile/
lib.rs

1//! # Ristretto `ClassFile`
2//!
3//! [![Code Coverage](https://codecov.io/gh/theseus-rs/ristretto/branch/main/graph/badge.svg)](https://codecov.io/gh/theseus-rs/ristretto)
4//! [![Benchmarks](https://img.shields.io/badge/%F0%9F%90%B0_bencher-enabled-6ec241)](https://bencher.dev/perf/theseus-rs-ristretto)
5//! [![License](https://img.shields.io/crates/l/ristretto_classfile)](https://github.com/theseus-rs/ristretto#license)
6//! [![Semantic Versioning](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F_SemVer-2.0.0-blue)](https://semver.org/spec/v2.0.0.html)
7//!
8//! ## Getting Started
9//!
10//! Implementation of the [JVM Class File Format](https://docs.oracle.com/javase/specs/jvms/se24/html/jvms-4.html) that
11//! is used to read, write and verify Java classes.
12//!
13//! Supports reading and writing class files for any version of Java version up to 25. Verification
14//! of class files is supported, but is still a work in progress.
15//!
16//! # Examples
17//!
18//! ```rust
19//! use ristretto_classfile::{ClassFile, ConstantPool, Result, Version};
20//!
21//! fn main() -> Result<()> {
22//!     let mut constant_pool = ConstantPool::default();
23//!     let this_class = constant_pool.add_class("Foo")?;
24//!     let class_file = ClassFile {
25//!         version: Version::Java21 { minor: 0 },
26//!         constant_pool,
27//!         this_class,
28//!         ..Default::default()
29//!     };
30//!     class_file.verify()
31//! }
32//! ```
33//!
34//! ## Safety
35//!
36//! This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% safe Rust.
37
38#![forbid(unsafe_code)]
39#![forbid(clippy::allow_attributes)]
40#![allow(dead_code)]
41#![deny(clippy::pedantic)]
42#![deny(clippy::unwrap_in_result)]
43#![deny(clippy::unwrap_used)]
44extern crate core;
45
46pub mod attributes;
47mod base_type;
48mod class_access_flags;
49mod class_file;
50mod constant;
51mod constant_pool;
52mod display;
53mod error;
54mod field;
55mod field_access_flags;
56mod field_type;
57mod method;
58mod method_access_flags;
59pub mod mutf8;
60mod reference_kind;
61mod verifiers;
62mod version;
63
64pub use base_type::BaseType;
65pub use class_access_flags::ClassAccessFlags;
66pub use class_file::ClassFile;
67pub use constant::Constant;
68pub use constant_pool::ConstantPool;
69pub use error::{Error, Result};
70pub use field::Field;
71pub use field_access_flags::FieldAccessFlags;
72pub use field_type::FieldType;
73pub use method::Method;
74pub use method_access_flags::MethodAccessFlags;
75pub use reference_kind::ReferenceKind;
76pub use version::{JAVA_PREVIEW_MINOR_VERSION, Version};