mirror of
https://gitlab.cern.ch/wotsubo/endcap-sl-software-ri-generator.git
synced 2025-02-23 17:17:08 +09:00
fix(generator): syntax for top level doccment
This commit is contained in:
parent
76310c64a3
commit
3e72513b75
1 changed files with 21 additions and 19 deletions
|
@ -252,7 +252,7 @@ impl CodeGen for Block {
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
let out = quote! {
|
let out = quote! {
|
||||||
#[doc = #desc]
|
#![doc = #desc]
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
@ -343,32 +343,34 @@ impl CodeGen for Register {
|
||||||
type_ux,
|
type_ux,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let desc = self.desc.unwrap_or("".to_string());
|
||||||
|
|
||||||
let out = quote! {
|
let out = quote! {
|
||||||
pub mod #snake_case_name {
|
#![doc = #desc]
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
use crate::register_spec::{DataConversionError, Modifiable, Readable, RegisterSpec, Writable};
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
const OFFSET: usize = #addr;
|
use crate::register_spec::{DataConversionError, Modifiable, Readable, RegisterSpec, Writable};
|
||||||
|
|
||||||
pub struct #reg_name<'a> {
|
const OFFSET: usize = #addr;
|
||||||
mem_ptr: *mut u32,
|
|
||||||
_marker: PhantomData<&'a mut super::#parent_name<'a>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl #reg_name<'_> {
|
pub struct #reg_name<'a> {
|
||||||
pub(crate) fn new(parent_ptr: *mut u32) -> Self {
|
mem_ptr: *mut u32,
|
||||||
#reg_name {
|
_marker: PhantomData<&'a mut super::#parent_name<'a>>,
|
||||||
mem_ptr: unsafe { parent_ptr.add(OFFSET) },
|
}
|
||||||
_marker: PhantomData,
|
|
||||||
}
|
impl #reg_name<'_> {
|
||||||
|
pub(crate) fn new(parent_ptr: *mut u32) -> Self {
|
||||||
|
#reg_name {
|
||||||
|
mem_ptr: unsafe { parent_ptr.add(OFFSET) },
|
||||||
|
_marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#code_reg_def
|
|
||||||
|
|
||||||
#code_t_def
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#code_reg_def
|
||||||
|
|
||||||
|
#code_t_def
|
||||||
};
|
};
|
||||||
|
|
||||||
let (out_path, _next_parent_path) = mod_file_path(parent_path, &snake_case_name);
|
let (out_path, _next_parent_path) = mod_file_path(parent_path, &snake_case_name);
|
||||||
|
|
Loading…
Reference in a new issue