This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{File,IoResult,UserRWX}; | |
use std::os; | |
use std::io::TempDir; | |
use std::io::fs; | |
pub struct FileUtils { | |
pub path:Option<TempDir> | |
} | |
impl FileUtils { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
import System.Collections.Generic; | |
/** Create a new instance */ | |
public static function factory(dx:int, dy:int, size:float):TacticsMap { | |
var rtn = new TacticsMap(); | |
rtn.tiles = new int[dx * dy]; | |
rtn.heights = new int[dx * dy]; | |
rtn.dx = dx; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dougs-Mac-mini:rust-array doug$ cargo test | |
Compiling array v0.1.6 (file:///Users/doug/dev/rust-array) | |
src/array.rs:140:64: 140:72 error: explicit lifetime bound required | |
src/array.rs:140 impl<'a, T: PartialEq + Clone + Default> Index<uint,T> for &'a Array<T> { | |
^~~~~~~~ | |
src/array.rs:147:71: 147:79 error: explicit lifetime bound required | |
src/array.rs:147 impl<'a, T: PartialEq + Clone + Default> IndexMut<uint,T> for &'a mut Array<T> { | |
^~~~~~~~ | |
src/view.rs:13:14: 13:22 error: explicit lifetime bound required | |
src/view.rs:13 parent:&'a Array<T>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<'a> Iterator<Path> for GlobIter<'a> { | |
fn next(&mut self) -> Option<Path> { | |
match self.walker { | |
Some(ref mut walker) => { | |
let mut ended = false; | |
while !ended { | |
match walker.next() { | |
Some(v) => { | |
match v.lstat() { | |
Ok(stats) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.3.14) | |
// Compass (v1.0.0) | |
// ---- | |
@function str-split($value) { | |
$rtn: (); | |
$tmp: $value; | |
$busy: true; | |
@while $busy { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Invoke this when the last 'length' nodes are all the same repeat type. | |
/// If the node before the first one is *also* that type, merge into that | |
/// node; otherwise perform the default repeat action. | |
fn reduce_repeat<'a>(&self, stack:&mut Vec<AstNode<'a, T>>, id:T, length:uint) { | |
let mut merged:Vec<AstNode<'a, T>> = Vec::new(); | |
for i in range(0, length) { | |
merged.push(stack.pop().unwrap()); | |
} | |
trace!("Trying to peform a repeat reducation...!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function str-split($value) { | |
$rtn: (); | |
$tmp: $value; | |
$busy: true; | |
@while $busy { | |
$index: str-index($tmp, ' '); | |
@if $index { | |
$bit: str-slice($tmp, 0, $index - 1); | |
$rtn: append($rtn, $bit); | |
$tmp: str-slice($tmp, $index + 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fresh array v0.1.4 (https://github.com/shadowmint/rust-array?ref=0.1.5#f574f1a3) | |
Compiling txt v0.1.0 (file:///Users/doug/dev/rust-txt) | |
src/parser/parser.rs:63:18: 63:35 error: cannot infer an appropriate lifetime for autoref due to conflicting requirements | |
src/parser/parser.rs:63 for token in ast.tokens.iter() { | |
^~~~~~~~~~~~~~~~~ | |
src/parser/parser.rs:62:3: 83:4 note: consider using an explicit lifetime parameter as shown: fn phase_pattern_match(&'a self, ast: &'a mut Ast<'a, T>) | |
src/parser/parser.rs:62 fn phase_pattern_match(&'a self, ast:&mut Ast<'a, T>) { | |
src/parser/parser.rs:63 for token in ast.tokens.iter() { | |
src/parser/parser.rs:64 let mut matched = false; | |
src/parser/parser.rs:65 self.patterns.iter().all(|pattern| -> bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/string.rs:371:3: 379:4 note: consider using an explicit lifetime parameter as shown: fn clone(&self) -> String<'a> | |
src/string.rs:371 fn clone(&self) -> String<'b> { | |
src/string.rs:372 return String { | |
src/string.rs:373 len: self.len, | |
src/string.rs:374 bytes: match self.bytes { | |
src/string.rs:375 IsStatic(ref x) => IsStatic(x.as_array().clone()), | |
src/string.rs:376 IsView(ref x) => IsStatic(x.as_array().clone()) | |
... | |
src/string.rs:371:3: 379:4 error: method not compatible with trait: expected `fn(&string::String<'a>) -> string::String<'a>` but found `fn(&string::String<'a>) -> string::String<'b>` (lifetime mismatch) | |
src/string.rs:371 fn clone(&self) -> String<'b> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def url(self, image, width=None, height=None): | |
"""Generate a scaled image url from the given values """ | |
if width is None: | |
width = image.width | |
if height is None: | |
height = image.height | |
scales = image.restrictedTraverse('@@images') | |
scaled_image = scales.scale( | |
'image', | |
width=width, |