pub struct MethodProfileBuilder { /* private fields */ }Expand description
Mutable builder for MethodProfile.
This follows the existing builder pattern used elsewhere in common and
keeps callers away from constructors with too many arguments.
§Examples
use whitaker_common::decomposition_advice::MethodProfileBuilder;
let mut builder = MethodProfileBuilder::new("write_cache");
builder
.record_external_domain("std::fs")
.record_local_type("PathBuf");
let profile = builder.build();
assert_eq!(profile.external_domains().iter().next().map(String::as_str), Some("std::fs"));Implementations§
Source§impl MethodProfileBuilder
impl MethodProfileBuilder
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates an empty builder for the given method name.
Sourcepub fn record_accessed_field(
&mut self,
field_name: impl Into<String>,
) -> &mut Self
pub fn record_accessed_field( &mut self, field_name: impl Into<String>, ) -> &mut Self
Records an accessed field.
Sourcepub fn record_signature_type(
&mut self,
type_name: impl Into<String>,
) -> &mut Self
pub fn record_signature_type( &mut self, type_name: impl Into<String>, ) -> &mut Self
Records a signature type.
Sourcepub fn record_local_type(&mut self, type_name: impl Into<String>) -> &mut Self
pub fn record_local_type(&mut self, type_name: impl Into<String>) -> &mut Self
Records a local-variable type.
Sourcepub fn record_external_domain(&mut self, domain: impl Into<String>) -> &mut Self
pub fn record_external_domain(&mut self, domain: impl Into<String>) -> &mut Self
Records an external domain.
Sourcepub fn build(self) -> MethodProfile
pub fn build(self) -> MethodProfile
Builds the immutable profile.
Trait Implementations§
Source§impl Clone for MethodProfileBuilder
impl Clone for MethodProfileBuilder
Source§fn clone(&self) -> MethodProfileBuilder
fn clone(&self) -> MethodProfileBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MethodProfileBuilder
impl Debug for MethodProfileBuilder
Source§impl Default for MethodProfileBuilder
impl Default for MethodProfileBuilder
Source§fn default() -> MethodProfileBuilder
fn default() -> MethodProfileBuilder
Returns the “default value” for a type. Read more
impl Eq for MethodProfileBuilder
Source§impl PartialEq for MethodProfileBuilder
impl PartialEq for MethodProfileBuilder
impl StructuralPartialEq for MethodProfileBuilder
Auto Trait Implementations§
impl Freeze for MethodProfileBuilder
impl RefUnwindSafe for MethodProfileBuilder
impl Send for MethodProfileBuilder
impl Sync for MethodProfileBuilder
impl Unpin for MethodProfileBuilder
impl UnsafeUnpin for MethodProfileBuilder
impl UnwindSafe for MethodProfileBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more