Remove redundant doc comments

This commit is contained in:
a2x
2024-03-02 01:02:58 +10:00
parent c731cab0a0
commit 127cd110bb
24 changed files with 103 additions and 969 deletions

View File

@@ -1,54 +1,25 @@
use anyhow::Result;
use super::SchemaType;
use crate::util::{Address, Process};
use anyhow::Result;
/// Represents data for a field in a schema class.
pub struct SchemaClassFieldData<'a> {
process: &'a Process,
address: Address,
}
impl<'a> SchemaClassFieldData<'a> {
/// Creates a new `SchemaClassFieldData` instance.
///
/// # Arguments
///
/// * `process` - A reference to the `Process` struct.
/// * `address` - The address of the `SchemaClassFieldData` instance.
///
/// # Returns
///
/// * `SchemaClassFieldData` - The new `SchemaClassFieldData` instance.
pub fn new(process: &'a Process, address: Address) -> Self {
Self { process, address }
}
/// Returns the name of the field.
///
/// # Arguments
///
/// * `&self` - A reference to the `SchemaClassFieldData` struct.
///
/// # Returns
///
/// * `Result<String>` - The name of the field.
pub fn name(&self) -> Result<String> {
let name_ptr = self.process.read_memory::<usize>(self.address)?;
self.process.read_string_length(name_ptr.into(), 64)
}
/// Returns the `SchemaType` of the field.
///
/// # Arguments
///
/// * `&self` - A reference to the `SchemaClassFieldData` struct.
///
/// # Returns
///
/// * `Result<SchemaType>` - The `SchemaType` of the field.
pub fn r#type(&self) -> Result<SchemaType> {
Ok(SchemaType::new(
self.process,
@@ -58,15 +29,6 @@ impl<'a> SchemaClassFieldData<'a> {
))
}
/// Returns the offset of the field.
///
/// # Arguments
///
/// * `&self` - A reference to the `SchemaClassFieldData` struct.
///
/// # Returns
///
/// * `Result<u16>` - The offset of the field.
pub fn offset(&self) -> Result<u16> {
self.process.read_memory::<u16>(self.address + 0x10)
}