pub struct BasicLinkValidator { /* private fields */ }Expand description
Default validator: checks basic I/O compatibility
This validator implements the standard validation rules:
- Pins must exist
- Pins must be on different nodes
- One pin must be input, one must be output
Returns detailed error information via ValidationResult.
§Example
use slint_node_editor::{
BasicLinkValidator, GeometryCache, LinkValidator, SimpleLink,
SimpleNodeGeometry,
};
let mut cache = GeometryCache::<SimpleNodeGeometry>::new();
cache.update_node_rect(1, 0.0, 0.0, 100.0, 60.0);
cache.update_node_rect(2, 200.0, 0.0, 100.0, 60.0);
cache.handle_pin_report(3, 1, 2, 100.0, 30.0);
cache.handle_pin_report(4, 2, 1, 0.0, 30.0);
let links = Vec::<SimpleLink>::new();
let validator = BasicLinkValidator::new(2);
assert!(validator.validate(3, 4, &cache, &links).is_valid());Implementations§
Trait Implementations§
Source§impl Clone for BasicLinkValidator
impl Clone for BasicLinkValidator
impl Copy for BasicLinkValidator
Source§impl Debug for BasicLinkValidator
impl Debug for BasicLinkValidator
Source§impl<N, L> LinkValidator<N, L> for BasicLinkValidatorwhere
N: NodeGeometry + Copy,
impl<N, L> LinkValidator<N, L> for BasicLinkValidatorwhere
N: NodeGeometry + Copy,
Source§fn validate(
&self,
start_pin: i32,
end_pin: i32,
cache: &GeometryCache<N>,
_links: &[L],
) -> ValidationResult
fn validate( &self, start_pin: i32, end_pin: i32, cache: &GeometryCache<N>, _links: &[L], ) -> ValidationResult
Check if a link between two pins is valid Read more
Auto Trait Implementations§
impl Freeze for BasicLinkValidator
impl RefUnwindSafe for BasicLinkValidator
impl Send for BasicLinkValidator
impl Sync for BasicLinkValidator
impl Unpin for BasicLinkValidator
impl UnsafeUnpin for BasicLinkValidator
impl UnwindSafe for BasicLinkValidator
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