pub fn snap_location(&self, location:Location) -> Location {
        use BoundsError::*;
        match self.validate_line_index(location.line) {
            Err(TooSmall) => self.first_line_start_location(),
            Err(TooBig)   => self.last_line_end_location(),
            Ok(line)      => {
                let column = min(location.column,self.line_end_column(line).unwrap());
                Location(line,column)
            }
        }
    }
/// Constraint the provided location so it will be contained of the range of this data. This
/// ensures that the resulting location will be valid for operations on this data.
Constraint the provided location so it will be contained of the range of this data. This
ensures that the resulting location will be valid for operations on this data.
Constraint the provided location so it will be contained of the range of this data . This ensures that the resulting location will be valid for operations on this data .
pub fn snap_location(&self, location:Location) -> Location {
        use BoundsError::*;
        match self.validate_line_index(location.line) {
            Err(TooSmall) => self.first_line_start_location(),
            Err(TooBig)   => self.last_line_end_location(),
            Ok(line)      => {
                let column = min(location.column,self.line_end_column(line).unwrap());
                Location(line,column)
            }
        }
    }
pub fn snap_location ( & self , location : Location ) -> Location { use BoundsError :: * ; match self . validate_line_index ( location . line ) { Err ( TooSmall ) => self . first_line_start_location ( ) , Err ( TooBig ) => self . last_line_end_location ( ) , Ok ( line ) => { let column = min ( location . column , self . line_end_column ( line ) . unwrap ( ) ) ; Location ( line , column ) } } }
Constraint the provided location so it will be contained of the range of this data.
Constraint the provided location so it will be contained of the range of this data .
&self
location
Location
&self
location
Location