Size: a a a

2020 April 27

r

red75prime in rust_offtopic
fn sanitize_file_name(ManyOptions) -> Result<(ManyOptions, FileName), ManyOptions>
источник

DS

Doge Shibu in rust_offtopic
Gymmasssorla
например?
Есть идиотское решения вида:
struct WatchMe<Thumb = Option<PhotoSize>, FileName = Option<String>, MimeType = Option<MimeWrapper>, FileSize = Option<u32>> {
   duration: u32,
   thumb: Thumb,
   file_name: FileName,
   mime_type: MimeType,
   file_size: FileSize
}
источник

G

Gymmasssorla in rust_offtopic
Doge Shibu
Есть идиотское решения вида:
struct WatchMe<Thumb = Option<PhotoSize>, FileName = Option<String>, MimeType = Option<MimeWrapper>, FileSize = Option<u32>> {
   duration: u32,
   thumb: Thumb,
   file_name: FileName,
   mime_type: MimeType,
   file_size: FileSize
}
а как мне заставить серде жсон это десериализовать?
источник

DS

Doge Shibu in rust_offtopic
Gymmasssorla
а как мне заставить серде жсон это десериализовать?
Из коробки не подхватывается, если развесить аттрибуты?
источник

DS

Doge Shibu in rust_offtopic
А, десериализация
источник

DS

Doge Shibu in rust_offtopic
Тут никак
источник

DS

Doge Shibu in rust_offtopic
Gymmasssorla
а как мне заставить серде жсон это десериализовать?
Можно десериализовывать WatchMe с Option'ами, а потом перегонять в нужный тип с замененными Option<A> на A

Ну и да, ты хочешь зав типы по сути
источник

G

Gymmasssorla in rust_offtopic
Doge Shibu
Можно десериализовывать WatchMe с Option'ами, а потом перегонять в нужный тип с замененными Option<A> на A

Ну и да, ты хочешь зав типы по сути
спасибо, подумаю
источник

А⚙

Антон ⚙️ in rust_offtopic
λоλторт
алло уже месяц прошёл
Ещё месяц подожду
источник

AZ

Alex Zhukovsky in rust_offtopic
источник

G

Gymmasssorla in rust_offtopic
Ого
источник

G

Gymmasssorla in rust_offtopic
Почитаю
источник

AZ

Alex Zhukovsky in rust_offtopic
Traditionally, types are seen as a tool for checking for errors, with the programmer writing a complete program first and using either the compiler or the runtime system to detect type errors. In typedriven development, we use types as a tool for constructing programs. We put the type first, treating it as a plan for a program, and use the compiler and type checker as our assistant, guiding us to a complete and working program that satisfies the type. The more expressive the type is that we give up front, the more confidence we can have that the resulting program will be correct.
источник

p

polunin.ai in rust_offtopic
нормально реализовывать методы на Vec<T> ? или стоит сделать ньютайп?
источник

AZ

Alex Zhukovsky in rust_offtopic
polunin.ai
нормально реализовывать методы на Vec<T> ? или стоит сделать ньютайп?
методы на vec ты реализовать не сможешь. ты можешь сделать VecExt только, либо как ньютайп, либо как трейт
источник

AZ

Alex Zhukovsky in rust_offtopic
What is a type?
We’re taught from an early age to recognize and distinguish types of objects. As a young child, you may have had a shape-sorter toy. This consists of a box with variously shaped holes in the top (see figure 1.1) and some shapes that fit through the holes. Sometimes they’re equipped with a small plastic hammer. The idea is to fit each shape (think of this as a “value”) into the appropriate hole (think of this as a “type”), possibly with coercion from the hammer.
источник

p

polunin.ai in rust_offtopic
Alex Zhukovsky
методы на vec ты реализовать не сможешь. ты можешь сделать VecExt только, либо как ньютайп, либо как трейт
ну я имел ввиду через трейт
источник

AZ

Alex Zhukovsky in rust_offtopic
оба варианта нормальные
источник

p

polunin.ai in rust_offtopic
Alex Zhukovsky
What is a type?
We’re taught from an early age to recognize and distinguish types of objects. As a young child, you may have had a shape-sorter toy. This consists of a box with variously shaped holes in the top (see figure 1.1) and some shapes that fit through the holes. Sometimes they’re equipped with a small plastic hammer. The idea is to fit each shape (think of this as a “value”) into the appropriate hole (think of this as a “type”), possibly with coercion from the hammer.
ты решил почитать книгу type driven development in idris?
источник

AZ

Alex Zhukovsky in rust_offtopic
polunin.ai
ты решил почитать книгу type driven development in idris?
да, давно собирался
источник