snippets: struct write method