pub struct InferenceResult {
pub value: Value,
pub inferred_type: ExpectedType,
pub confidence: InferenceConfidence,
}Expand description
Result of type inference with confidence level.
This structure provides detailed information about the outcome of bidirectional type inference, including the inferred value, its type, and how confident we are in the inference.
§Examples
use hedl_core::inference::{infer_value_synthesize, InferenceContext};
use std::collections::BTreeMap;
let aliases = BTreeMap::new();
let ctx = InferenceContext::for_key_value(&aliases);
let result = infer_value_synthesize("42", &ctx, 1).unwrap();
// result.value is Int(42)
// result.inferred_type is ExpectedType::Int
// result.confidence is InferenceConfidence::CertainFields§
§value: ValueThe inferred value
inferred_type: ExpectedTypeThe inferred type
confidence: InferenceConfidenceConfidence in the inference
Trait Implementations§
Source§impl Clone for InferenceResult
impl Clone for InferenceResult
Source§fn clone(&self) -> InferenceResult
fn clone(&self) -> InferenceResult
Returns a duplicate of the value. Read more
1.0.0 · 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 InferenceResult
impl Debug for InferenceResult
Source§impl PartialEq for InferenceResult
impl PartialEq for InferenceResult
impl StructuralPartialEq for InferenceResult
Auto Trait Implementations§
impl Freeze for InferenceResult
impl RefUnwindSafe for InferenceResult
impl Send for InferenceResult
impl Sync for InferenceResult
impl Unpin for InferenceResult
impl UnwindSafe for InferenceResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more