fn index_to_rust_end(index: Number, s: &str) -> Result<usize, Error> {
    let index = require_integer(index)?;
    Ok(if index.is_negative() {
        let len = s.chars().count();
        let i = index.abs() as usize - 1;
        if i <= len {
            len - i
        } else {
            0
        }
    } else if index.is_positive() {
        index as usize
    } else {
        0
    })
}
/// Convert index from sass (rational number, first is one) to rust
/// (usize, first is zero).  Sass values might be negative, then -1 is
/// the last char in the string.
Convert index from sass (rational number, first is one) to rust
(usize, first is zero).  Sass values might be negative, then -1 is
the last char in the string.
Convert index from sass ( rational number first is one ) to rust ( usize first is zero ) . Sass values might be negative then - 1 is the last char in the string .
fn index_to_rust_end(index: Number, s: &str) -> Result<usize, Error> {
    let index = require_integer(index)?;
    Ok(if index.is_negative() {
        let len = s.chars().count();
        let i = index.abs() as usize - 1;
        if i <= len {
            len - i
        } else {
            0
        }
    } else if index.is_positive() {
        index as usize
    } else {
        0
    })
}
fn index_to_rust_end ( index : Number , s : & str ) -> Result < usize , Error > { let index = require_integer ( index ) ? ; Ok ( if index . is_negative ( ) { let len = s . chars ( ) . count ( ) ; let i = index . abs ( ) as usize - 1 ; if i <= len { len - i } else { 0 } } else if index . is_positive ( ) { index as usize } else { 0 } ) }
Convert index from sass (rational number, first is one) to rust
(usize, first is zero).
Convert index from sass ( rational number first is one ) to rust ( usize first is zero ) .
index
Number
s
&str
index
Number
s
&str