pub struct NoDuplicatesValidator;Expand description
Validator that prevents duplicate links
This wraps the existing GraphLogic::duplicate_link_exists helper.
Pass it to validate_and_normalize_link so gestures that begin at an
input pin are normalized before the ordered pair is checked.
§Example
use slint::{Color};
use slint_node_editor::{
GeometryCache, LinkValidator, NoDuplicatesValidator, SimpleLink,
SimpleNodeGeometry, ValidationResult,
};
let cache = GeometryCache::<SimpleNodeGeometry>::new();
let links = vec![SimpleLink::new(1, 3, 4, Color::from_rgb_u8(1, 2, 3))];
let result = NoDuplicatesValidator.validate(3, 4, &cache, &links);
assert!(matches!(result, ValidationResult::Invalid(_)));Trait Implementations§
Source§impl Clone for NoDuplicatesValidator
impl Clone for NoDuplicatesValidator
Source§impl Debug for NoDuplicatesValidator
impl Debug for NoDuplicatesValidator
Source§impl Default for NoDuplicatesValidator
impl Default for NoDuplicatesValidator
Source§impl<N, L> LinkValidator<N, L> for NoDuplicatesValidator
impl<N, L> LinkValidator<N, L> for NoDuplicatesValidator
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 NoDuplicatesValidator
impl RefUnwindSafe for NoDuplicatesValidator
impl Send for NoDuplicatesValidator
impl Sync for NoDuplicatesValidator
impl Unpin for NoDuplicatesValidator
impl UnsafeUnpin for NoDuplicatesValidator
impl UnwindSafe for NoDuplicatesValidator
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