Rust
-
러스트로 MPEG-4 파일 시스템 라이브러리를 만들어보자.Streaming Media/Media Tech 2021. 7. 12. 13:33
스푼라디오에 재직하던 시절 작성한 "러스트로 MPEG-4 파일 시스템 라이브러리를 만들었던 경험"을 소개합니다. ISO BMFF를 구현한 순수한 러스트 크레이트는 전부 인큐베이팅 수준에 불과했습니다. 미디어 데이터를 읽어서 재생할 수도 인코딩된 데이터를 저장할 수도 없었습니다. 새로운 크레이터를 만들까 고민하다가, 약간이라도 진행된 mp4rs를 선택하여 사용 가능한 수준으로 개선하기로 했습니다. https://medium.com/spoontech/rust로-mpeg-4-파일-시스템-라이브러리를-만들어보자-4dd73e3bf77b 전체 내용은 원문으로 확인하세요. 추가 mp4rs에서 mp4-rust로 이름이 바뀌었다. 코드는 https://github.com/alfg/mp4-rust에서 문서는 https:/..
-
언어별 형식 출력 함수 비교Programmer/Programming 2021. 7. 9. 12:50
언어별 형식 출력 함수와 형식 변환 지정자 C Go C++ fmt Rust Python Javascript ES6 Template literals Common Lisp 표준출력 printf( "%d", 3) fmt.Printf( "%d", 3) fmt.print( "{}", 3) print!( "{}", 3) print( "{}".format(3)) let n = 3; console.log( `${n}`) (format t "~d" 3) 파일출력 fprintf( fh, "%d", 3) fmt.Fprintf( fh, "%d", 3) fmt.print( fh, "{}", 3) write!( fh, "{}", 3) print( "{}".format(3), file = fh) let n = 3; fs.write..
-
러스트(Rust)를 위한 SyntaxHighlighter 3.0 플러그인 개선Programmer/Programming 2019. 2. 14. 18:27
2019년 Rust로 개발을 시작했다. 새롭게 알게 된 내용을 블로그에 기록하고 있다. 러스트 코드를 예쁘게 보여줄 기능이 필요했다. 아쉽게도, 내가 사용하는 SyntaxHighlighter의 기본 패키지는 러스트를 지원하지 않는다. 지난번 리스프 패키지 작성과 마찬가지로 서드파티 패키지를 추가해야했다. 운이 좋게도 누군가 만들어서 공개했다. https://silight.hatenablog.jp/entry/2015/06/18/211724 써보니 그리 나쁘지 않았지만, 부족한 부분이 엿보였다. 이전 글을 작성하면서 발견한 멀티라인을 추가했다. 2019년 2월 14일에 raw string, byte string을 추가했다. 코드는 https://github.com/unipro/shBrushes에 있다. le..
-
러스트와 다른 언어의 멀티라인 처리 비교Programmer/Programming 2019. 2. 12. 14:38
새줄문자가 들어간 스트링 리터럴 출력 Rust fn main() { println!("In the rooom the women come and go, Singing of Mount Abora"); } 결과 : 스트링 리터럴의 새줄문자와 공백문자를 그대로 출력 In the rooom the women come and go, Singing of Mount Abora C #include int main() { printf("In the rooom the women come and go, Singing of Mount Abora"); putchar('\n'); } 결과 : 빌드 실패 cc -Wall -O2 -o prt_nl_str prt_nl_str.c prt_nl_str.c:5:12: warning: miss..
-
러스트에서 문자열을 효과적으로 연결하기Programmer/Programming 2019. 2. 8. 17:41
러스트(rust)에서 문자열을(&String or &str)을 연결(concatenation)하는 방법에는 여러가지가 있다. SliceConcatExt::concat() -> String SliceConcatExt::join(sep: &str) -> String Add::add(rhs: &str) -> String String::push_str(string: &str) -> String write! and writteln! macros SliceConcatExt::concat() -> String 문자열의 슬라이스(slice)에서 concat() 메서드를 호출하면 각 요소를 연결한 문자열을 생성한다. SliceConcatExt::join(sep: &str) -> String 각 문자열 요소 사이에 지정된..