최근 변경
최근 토론
특수 기능
파일 올리기
작성이 필요한 문서
고립된 문서
고립된 분류
분류가 되지 않은 문서
편집된 지 오래된 문서
내용이 짧은 문서
내용이 긴 문서
차단 내역
RandomPage
라이선스
IP 사용자
216.73.216.170
설정
다크 모드로 전환
로그인
iced
(r7 RAW)
[[분류:GUI 프레임워크]][[분류:Rust로 개발된 소프트웨어]] ||<-2><tablealign=right><tablewidth=450><tablebordercolor=#30f><tablebgcolor=transparent><colbgcolor=#30f><colcolor=#fff> '''{{{+3 Iced}}}''' || ||<bgcolor=transparent><nopad><-2> [[파일:iced logo.svg|width=60%]] || ||<width=25%> '''개발자''' ||'''hecrj''' || || '''링크''' ||[[https://github.com/iced-rs/iced|[[파일:GitHub 아이콘 light.svg|width=25px&theme=light]][[파일:GitHub 아이콘 dark.svg|width=25px&theme=dark]]]] [[https://docs.rs/iced/latest/iced|[[파일:Docs.rs logo.png]]]] [[https://crates.io/crates/iced|[[파일:Crates.io logo.png|width=25px]]]]|| [목차] [clearfix] == 개요 == 러스트의 GUI 프레임워크이다. == 사용법 == [[iced 구조.svg]] iced는 기본적으로 위의 구조를 갖고 있다. 먼저 UI에서 사용자가 상호작용하면 update 로직에 보낼 Message 열거를 만들어보자 {{{#syntax rust enum Message { Hello, Bye }}}} 그리고 데이터를 담을 state 구조체를 만들자 {{{#syntax rust #[derive(Default)] struct State { say:String }}}} say의 기본값을 "hello"로 지정해주고 싶으면 derive 메크로를 제거하고 {{{#syntax rust impl Default for State { fn default() Self { Self { say:String::from("hello"); } } }}}}를 추가해주자.[* 사실 iced::application이라는 대응 함수도 있는데 부실한 문서화때문에 사용하기 어렵다] 그리고 상호작용을 할 때 실행될 update 함수를 만들자 {{{#syntax rust fn update(state:&mut State, message:Message) { match Message { Hello => { state.say = String::from("Hello"); }, Bye => { state.say = String::from("Bye"); } } }}}} 마지막으로 UI를 담당할 view 함수를 만들고 {{{#syntax rust use iced::Element; use iced::widget::{button, column, text}; fn view(state: &State) -> Element<'_, Message> { column![ text(state.say), button("say hello").on_press(Message::Hello), button("say bye").on_press(Message::Bye) ].into() }}}} iced::run으로 실행하자 {{{#syntax rust fn main () -> iced::Result { iced::run(update, view)? }}}} == 특징 == * 마지막 릴리즈가 ,,25년 9월 기준,,1년 전에 나왔다![* cargo add iced 대신 깃헙 주소를 입력하는 것을 추천한다. 브랜치는 master로] * 비동기 처리를 자체 런타임을 이용해서 하는데 tokio[* 러스트에서 가장 많이쓰는 런타임] 런타임이랑 호환이 안되는듯 하다 == 사용하는 소프트웨어 == * cosmic
사용자
216.73.216.170
IP 사용자
로그인
회원가입
최근 변경
[불러오는 중...]
최근 토론
[불러오는 중...]