Skip to content

Commit

Permalink
constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
taegyunkim committed May 31, 2024
1 parent 6dd7e99 commit 78d2c05
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions profiling/src/internal/profile/fuzz_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ pub struct Function {
pub start_line: i64,
}

impl Function {
pub fn new(name: Box<str>, system_name: Box<str>, filename: Box<str>, start_line: i64) -> Self {
Self {
name,
system_name,
filename,
start_line,
}
}
}

impl<'a> From<&'a Function> for api::Function<'a> {
fn from(value: &'a Function) -> Self {
Self {
Expand Down Expand Up @@ -98,6 +109,17 @@ pub struct Location {
pub line: i64,
}

impl Location {
pub fn new(mapping: Mapping, function: Function, address: u64, line: i64) -> Self {
Self {
mapping,
function,
address,
line,
}
}
}

impl<'a> From<&'a Location> for api::Location<'a> {
fn from(value: &'a Location) -> Self {
Self {
Expand Down Expand Up @@ -131,6 +153,24 @@ pub struct Mapping {
pub build_id: Box<str>,
}

impl Mapping {
pub fn new(
memory_start: u64,
memory_limit: u64,
file_offset: u64,
filename: Box<str>,
build_id: Box<str>,
) -> Self {
Self {
memory_start,
memory_limit,
file_offset,
filename,
build_id,
}
}
}

impl<'a> From<&'a Mapping> for api::Mapping<'a> {
fn from(value: &'a Mapping) -> Self {
Self {
Expand Down

0 comments on commit 78d2c05

Please sign in to comment.